show.php

Code Hygiene Score: 99

Issues 1

Zeile Typ Beschreibung
96 magic_number Magic Number gefunden: 100

Code

<?php ob_start(); ?>

<nav class="breadcrumb">
    <a href="/">Home</a> &raquo; <a href="/explorer">Explorer</a> &raquo; <a href="/system-explorer">System Explorer</a> &raquo; <a href="/system-explorer/dokumente">Dokumente</a> &raquo; <?= htmlspecialchars($dokument['title']) ?>
</nav>

<h1><?= htmlspecialchars($dokument['title']) ?></h1>
<p><code><?= htmlspecialchars($dokument['path']) ?></code></p>

<div class="stats-grid">
    <div class="stat-card stat-card--info">
        <span class="stat-card__value"><?= count($seiten) ?></span>
        <span class="stat-card__label">Seiten</span>
    </div>
    <div class="stat-card stat-card--success">
        <span class="stat-card__value"><?= count($chunks) ?></span>
        <span class="stat-card__label">Direkte Chunks</span>
    </div>
</div>

<?php if (!empty($seiten)): ?>
<h2>Seiten</h2>
<table data-sortable>
    <thead>
        <tr>
            <th data-sort="title">Titel</th>
            <th data-sort="path">Pfad</th>
            <th data-sort="chunks">Chunks</th>
            <th data-sort="tokens">Tokens</th>
            <th>Aktionen</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($seiten as $s): ?>
        <tr>
            <td>
                <?php if ($s['depth'] > 1): ?>
                <span style="margin-left: <?= ($s['depth'] - 1) * 20 ?>px">
                <?php endif; ?>
                <a href="/system-explorer/seiten/<?= $s['id'] ?>"><?= htmlspecialchars($s['title']) ?></a>
                <?php if ($s['depth'] > 1): ?></span><?php endif; ?>
            </td>
            <td><code><?= htmlspecialchars($s['path']) ?></code></td>
            <td><?= $s['chunks_count'] ?></td>
            <td><?= number_format($s['token_count']) ?></td>
            <td>
                <a href="/system-explorer/seiten/<?= $s['id'] ?>" class="btn btn--small btn--primary">Details</a>
                <a href="/docs/<?= htmlspecialchars($s['path']) ?>" class="btn btn--small">Docs</a>
            </td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>

<?php if (!empty($taxonomy)): ?>
<h2>Taxonomie</h2>
<table>
    <tr><th>Kategorie</th><th>Chunks</th></tr>
    <?php foreach ($taxonomy as $t): ?>
    <tr>
        <td><span class="badge"><?= htmlspecialchars($t['taxonomy_category']) ?></span></td>
        <td><?= $t['count'] ?></td>
    </tr>
    <?php endforeach; ?>
</table>
<?php endif; ?>

<?php if (!empty($chunks)): ?>
<h2>Chunks (direkt)</h2>
<table>
    <thead>
        <tr>
            <th>Index</th>
            <th>Kategorie</th>
            <th>Tokens</th>
            <th>Status</th>
            <th>Inhalt</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($chunks as $c): ?>
        <tr>
            <td><a href="/system-explorer/chunks/<?= $c['id'] ?>">#<?= $c['chunk_index'] ?></a></td>
            <td><?php if ($c['taxonomy_category']): ?><span class="badge"><?= htmlspecialchars($c['taxonomy_category']) ?></span><?php endif; ?></td>
            <td><?= $c['token_count'] ?></td>
            <td>
                <?php if ($c['qdrant_id']): ?>
                <span class="badge badge--success">synced</span>
                <?php elseif ($c['analysis_status'] === 'completed'): ?>
                <span class="badge badge--info">analyzed</span>
                <?php else: ?>
                <span class="badge"><?= $c['analysis_status'] ?></span>
                <?php endif; ?>
            </td>
            <td><?= htmlspecialchars(substr(strip_tags($c['content']), 0, 100)) ?>...</td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>

<p class="links-bar">
    <a href="/system-explorer/dokumente">Alle Dokumente</a> |
    <a href="/docs/<?= htmlspecialchars($dokument['path']) ?>">In Docs anzeigen</a>
</p>

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