show.php

Code Hygiene Score: 100

Keine Issues gefunden.

Code

<?php ob_start(); ?>

<nav class="breadcrumb">
    <a href="/protokoll">KI-Protokoll</a> &raquo; Eintrag #<?= $entry['id'] ?>
</nav>

<h1>Protokoll #<?= $entry['id'] ?></h1>

<table>
    <tr><th>ID</th><td><?= $entry['id'] ?></td></tr>
    <tr><th>Zeitstempel</th><td><?= $entry['timestamp'] ?></td></tr>
    <tr><th>Client</th><td><?= htmlspecialchars($entry['client_name']) ?></td></tr>
    <tr><th>IP</th><td><?= htmlspecialchars($entry['request_ip']) ?></td></tr>
    <tr><th>Modell</th><td><?= htmlspecialchars($entry['model_name'] ?? '-') ?></td></tr>
    <tr><th>Status</th><td><span class="badge badge--<?= $entry['status'] === 'completed' ? 'completed' : ($entry['status'] === 'error' ? 'failed' : 'pending') ?>"><?= $entry['status'] ?></span></td></tr>
    <tr><th>Tokens</th><td><?= number_format($entry['tokens_total'] ?? 0) ?> (Input: <?= number_format($entry['tokens_input'] ?? 0) ?>, Output: <?= number_format($entry['tokens_output'] ?? 0) ?>)</td></tr>
    <tr><th>Dauer</th><td><?= $entry['duration_ms'] ? $entry['duration_ms'] . ' ms' : '-' ?></td></tr>
    <tr><th>Request-Zeit</th><td><?= $entry['request_timestamp'] ?></td></tr>
    <tr><th>Response-Zeit</th><td><?= $entry['response_timestamp'] ?? '-' ?></td></tr>
</table>

<?php if ($entry['error_message']): ?>
<h2>Fehlermeldung</h2>
<div class="error-box">
    <pre><?= htmlspecialchars($entry['error_message']) ?></pre>
</div>
<?php endif; ?>

<h2>Request</h2>
<div class="code-box">
    <pre><code><?= htmlspecialchars($entry['request_formatted']) ?></code></pre>
</div>

<h2>Response</h2>
<div class="code-box">
    <pre><code><?= htmlspecialchars($entry['response_formatted']) ?></code></pre>
</div>

<div class="action-bar">
    <?php if ($prevEntry): ?>
    <a href="/protokoll/<?= $prevEntry['id'] ?>" class="btn">&larr; Vorheriger</a>
    <?php endif; ?>
    <a href="/protokoll" class="btn">Zur Liste</a>
    <?php if ($nextEntry): ?>
    <a href="/protokoll/<?= $nextEntry['id'] ?>" class="btn">Nächster &rarr;</a>
    <?php endif; ?>
</div>

<style>
.code-box {
    background: var(--color-bg-secondary, #f5f5f5);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}
.code-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.error-box {
    background: var(--color-danger-bg, #fee);
    border: 1px solid var(--color-danger, #c00);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.error-box pre {
    margin: 0;
    color: var(--color-danger, #c00);
}
.action-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
}
</style>

<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>
← Übersicht