<?php
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: 0"); // Proxies
require 'auth.php';
requireLogin();
require 'db.php';
require './lang/translate.php';

$stmt = $pdo->query("SELECT * FROM signals ORDER BY timestamp DESC LIMIT 100;");
$signals = $stmt->fetchAll(PDO::FETCH_ASSOC);

foreach ($signals as $signal): ?>
<tr>
    <td><?= htmlspecialchars($signal['timestamp'] ?? '') ?></td>
    <td><?= htmlspecialchars($signal['account'] ?? '') ?></td>
    <td><?= htmlspecialchars($signal['event_code'] ?? '') ?></td>
    <td><?= htmlspecialchars($signal['zone'] ?? '') ?></td>
    <td><?= htmlspecialchars($signal['signal_text'] ?? '') ?></td>
    <td>
        <?php if (!empty($signal['v'])): ?>
            <button class="btn btn-primary w-100 openImageModalBtn" data-image="<?= htmlspecialchars($signal['v']) ?>">
                <?= htmlspecialchars($translations['image'] ?? 'Image') ?>
            </button>
        <?php endif; ?>
    </td>


    <td><?= htmlspecialchars($signal['source_ip'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
