hrefs still * point at parametres.php?tab=… so navigation degrades gracefully. * * Response: text/html fragment (no // wrapper). * On any auth failure or bad request: 403 / 400 with a plain-text body. */ require_once __DIR__ . "/../../bootstrap.php"; require_once __DIR__ . '/../../src/AdminAuth.php'; require_once APP_ROOT . '/src/Database.php'; require_once APP_ROOT . '/src/SystemCache.php'; require_once APP_ROOT . '/src/Controllers/SystemController.php'; if (!AdminAuth::isAuthenticated()) { http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); echo 'Non autorisé'; exit; } // ── Validate inputs ──────────────────────────────────────────────────────── $activeTab = $_GET['tab'] ?? 'app'; if (!array_key_exists($activeTab, SystemController::LOG_FILES)) { $activeTab = 'app'; } $selectedN = isset($_GET['n']) ? (int) $_GET['n'] : 100; if (!in_array($selectedN, SystemController::ALLOWED_LINES, true)) { $selectedN = 100; } header('Content-Type: text/html; charset=utf-8'); header('X-Robots-Tag: noindex'); // ── Build data via controller ────────────────────────────────────────────── $_db = new Database(); $_cache = new SystemCache($_db->getPDO()); $_controller = new SystemController($_db, $_cache); // ── Render ───────────────────────────────────────────────────────────────── $logData = $_controller->getLogData($activeTab, $selectedN); $logLines = $logData['lines']; $logError = $logData['error']; $logFileMeta = $logData['meta']; $logIsJson = $logData['isJson'] ?? false; $notYet = $logData['notYet'] ?? false; include APP_ROOT . '/templates/admin/partials/system-log-panel.php';