gmdate('Y-m-d\TH:i:s\Z'), 'rule' => $rule, 'bot' => $rule === 'tool' ? 'generic tooling' : $clean($env('A2T_BOT'), 60), 'ua' => $clean($ua, 200), 'path' => $clean(strtok($path, '?'), 200)]; if (isset($_SERVER['HTTP_X_A2T_PROBE'])) $row['probe'] = 1; // our own daily guard and verify runs $dir = dirname(rtrim((string)($_SERVER['DOCUMENT_ROOT'] ?? dirname(__DIR__)), '/\\')) . '/data'; $f = $dir . '/ai_gate_hits.jsonl'; if (is_dir($dir)) { if (@filesize($f) > 4000000) { @rename($f, $f . '.1'); } // cap: two files of 4 MB at most @file_put_contents($f, json_encode($row, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n", FILE_APPEND | LOCK_EX); } } catch (\Throwable $e) { }