getDebugMode(); $isOn = !empty($cfg['active']); // Resolve project root (max 5 levels up) to find the log file. $autoprefix = ''; for ($i = 0; $i < 5; $i++) { $autoprefix = str_repeat('../', $i); if (file_exists($autoprefix . 'autoloader.php')) { break; } } $logFile = $autoprefix . 'var/log/debug-players.log'; // Read the last lines for the on-screen viewer. $maxLines = 400; $lines = []; $logSize = 0; if (is_file($logFile)) { $logSize = filesize($logFile); $all = file($logFile, FILE_IGNORE_NEW_LINES); if ($all !== false) { $lines = array_slice($all, -$maxLines); } } // Active-since label + auto-off info. $since = !empty($cfg['started_at']) ? date('d.m.Y H:i', $cfg['started_at']) : '-'; $autoOff = (int)($cfg['auto_off_hours'] ?? 0); ?>
Transparent to players: errors are only written to the log file, never shown in-game and gameplay is unaffected.