Quelltext des aktuellen Standes
<?php $this->layout('layouts/admin', ['page_title' => $page_title, 'current_admin_page' => $current_admin_page]); ?>
<div class="settings-page">
<section class="settings-card">
<div class="settings-card-header">
<span class="settings-card-icon">📋</span>
<div>
<h2><?= $this->te('Logs') ?></h2>
<p class="settings-card-desc">
<?= $this->t('Zeigt das Ende einer Logdatei aus <code>storage/logs/</code>. Praktisch z. B. für den <code>scheduler.log</code> (Cron/Mail-Abruf).') ?>
</p>
</div>
</div>
<div class="settings-card-body">
<?php if (empty($files)): ?>
<p style="color:var(--gray-500);"><?= $this->te('Keine Logdateien vorhanden (Scheduler/Cron wurde evtl. noch nicht ausgeführt).') ?></p>
<?php else: ?>
<form method="GET" action="/admin/logs" style="display:flex;gap:0.75rem;align-items:flex-end;flex-wrap:wrap;margin-bottom:1rem;">
<div class="settings-field" style="min-width:220px;">
<label for="f-00d9-file" class="settings-label"><?= $this->te('Datei') ?></label>
<select id="f-00d9-file" name="file" class="settings-input" onchange="this.form.submit()">
<?php foreach ($files as $f): ?>
<option value="<?= $this->e($f) ?>" <?= $f === $selected ? 'selected' : '' ?>><?= $this->e($f) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="settings-field" style="width:120px;">
<label for="f-00d9-lines" class="settings-label"><?= $this->te('Zeilen') ?></label>
<input id="f-00d9-lines" type="number" name="lines" class="settings-input" value="<?= (int)$lines ?>" min="50" max="5000" step="50">
</div>
<div class="settings-field" style="flex:1;min-width:200px;">
<label class="settings-label"><?= $this->te('Filter (enthält …)') ?></label>
<input type="text" name="q" class="settings-input" value="<?= $this->e($filter) ?>" placeholder="<?= $this->te('z.B. error, Ticket, SQLSTATE') ?>">
</div>
<div style="padding-bottom:0.1rem;display:flex;gap:0.5rem;">
<button type="submit" class="btn btn-primary"><?= $this->te('Anzeigen') ?></button>
<a href="/admin/logs/download?file=<?= rawurlencode($selected) ?>" class="btn btn-secondary"><?= $this->te('Download') ?></a>
</div>
</form>
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:0.4rem;color:var(--gray-500);font-size:0.8rem;">
<span><strong><?= $this->e($selected) ?></strong><?php if ($mtime): ?> · <?= $this->te('geändert {zeitpunkt}', ['zeitpunkt' => $mtime]) ?><?php endif; ?></span>
<span><?= number_format($size / 1024, 1, ',', '.') ?> KB</span>
</div>
<pre id="logview" style="background:var(--gray-900);color:var(--gray-200);padding:1rem;border-radius:0.5rem;overflow:auto;max-height:70vh;font-size:0.78rem;line-height:1.45;white-space:pre-wrap;word-break:break-word;margin:0;"><?= $this->e($content) ?></pre>
<p style="margin:0.5rem 0 0;color:var(--gray-400);font-size:0.78rem;"><?= $this->t('Es werden die letzten {anzahl} (gefilterten) Zeilen angezeigt. Zum Aktualisieren erneut „Anzeigen" klicken.', ['anzahl' => (int)$lines]) ?></p>
<?php endif; ?>
</div>
</section>
</div>
<script>
// Beim Laden ans Ende des Logs scrollen (neueste Zeilen).
(function () {
var el = document.getElementById('logview');
if (el) el.scrollTop = el.scrollHeight;
})();
</script>