index.php

Code Hygiene Score: 100

Keine Issues gefunden.

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; Chunks
</nav>

<h1>Chunks</h1>
<p>Textabschnitte mit Vektor-Embeddings. Gesamt: <?= number_format($totalCount) ?> Chunks.</p>

<form method="get" class="filter-form">
    <input type="text" name="search" value="<?= htmlspecialchars($currentSearch) ?>" placeholder="Suche in Inhalt/Keywords...">
    <select name="category">
        <option value="">Alle Kategorien</option>
        <?php foreach ($categories as $cat): ?>
        <option value="<?= htmlspecialchars($cat) ?>" <?= $currentCategory === $cat ? 'selected' : '' ?>><?= htmlspecialchars($cat) ?></option>
        <?php endforeach; ?>
    </select>
    <select name="status">
        <option value="">Alle Status</option>
        <option value="pending" <?= $currentStatus === 'pending' ? 'selected' : '' ?>>Pending</option>
        <option value="completed" <?= $currentStatus === 'completed' ? 'selected' : '' ?>>Completed</option>
        <option value="failed" <?= $currentStatus === 'failed' ? 'selected' : '' ?>>Failed</option>
    </select>
    <button type="submit" class="btn btn--primary">Filtern</button>
    <?php if ($currentSearch || $currentCategory || $currentStatus): ?>
    <a href="/system-explorer/chunks" class="btn">Reset</a>
    <?php endif; ?>
</form>

<table data-sortable>
    <thead>
        <tr>
            <th data-sort="id">ID</th>
            <th data-sort="dokument_title">Dokument</th>
            <th data-sort="taxonomy_category">Kategorie</th>
            <th data-sort="token_count">Tokens</th>
            <th data-sort="analysis_status">Status</th>
            <th data-sort="content">Inhalt</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($chunks as $c): ?>
        <tr>
            <td><a href="/system-explorer/chunks/<?= $c['id'] ?>">#<?= $c['id'] ?></a></td>
            <td><a href="/docs/<?= htmlspecialchars($c['dokument_path']) ?>"><?= htmlspecialchars(substr($c['dokument_title'], 0, 30)) ?></a></td>
            <td>
                <?php if ($c['taxonomy_category']): ?>
                <a href="?category=<?= urlencode($c['taxonomy_category']) ?>">
                    <span class="badge"><?= htmlspecialchars($c['taxonomy_category']) ?></span>
                </a>
                <?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, 80)) ?>...</td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>

<?php if ($totalPages > 1): ?>
<div class="pagination">
    <?php if ($currentPage > 1): ?>
    <a href="?page=<?= $currentPage - 1 ?>&category=<?= urlencode($currentCategory) ?>&status=<?= urlencode($currentStatus) ?>&search=<?= urlencode($currentSearch) ?>" class="btn btn--small">&laquo; Zurück</a>
    <?php endif; ?>

    <span>Seite <?= $currentPage ?> von <?= $totalPages ?></span>

    <?php if ($currentPage < $totalPages): ?>
    <a href="?page=<?= $currentPage + 1 ?>&category=<?= urlencode($currentCategory) ?>&status=<?= urlencode($currentStatus) ?>&search=<?= urlencode($currentSearch) ?>" class="btn btn--small">Weiter &raquo;</a>
    <?php endif; ?>
</div>
<?php endif; ?>

<p class="links-bar">
    <a href="/system-explorer">Zurück zum Explorer</a>
</p>

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