<?php
require_once __DIR__.'/../includes/functions.php';
require_admin();
$adminTitle='Error Details';
$id=(int)($_GET['id']??0);
$error = $id && table_exists('mj_error_logs') ? one('SELECT * FROM mj_error_logs WHERE id=?',[$id]) : null;
include __DIR__.'/_header.php';
?>
<div class="card card-danger card-outline"><div class="card-header"><h3 class="card-title"><i class="fas fa-bug mr-2"></i>Error Details</h3></div><div class="card-body">
<?php if(!$error): ?><div class="alert alert-warning">Error not found.</div><?php else: ?>
<dl class="row"><dt class="col-sm-3">Type</dt><dd class="col-sm-9"><?= e($error['error_type']) ?></dd><dt class="col-sm-3">Message</dt><dd class="col-sm-9"><pre><?= e($error['error_message']) ?></pre></dd><dt class="col-sm-3">File</dt><dd class="col-sm-9"><?= e($error['error_file']) ?> : <?= e($error['error_line']) ?></dd><dt class="col-sm-3">URL</dt><dd class="col-sm-9"><a target="_blank" href="<?= e((str_starts_with($error['request_url'],'http')?'':'//').$error['request_url']) ?>"><?= e($error['request_url']) ?></a></dd><dt class="col-sm-3">IP / Browser</dt><dd class="col-sm-9"><?= e($error['ip_address']) ?><br><small><?= e($error['user_agent']) ?></small></dd><dt class="col-sm-3">Stack</dt><dd class="col-sm-9"><pre><?= e($error['stack_trace']) ?></pre></dd></dl>
<?php endif; ?></div></div>
<?php include __DIR__.'/_footer.php'; ?>
