prepare(" SELECT * FROM api_logs ORDER BY timestamp DESC LIMIT ? "); $stmt->execute([$limit]); $logs = $stmt->fetchAll(); // Get statistics $stmt = $pdo->query("SELECT COUNT(*) as total FROM api_logs"); $totalLogs = $stmt->fetch()['total']; $stmt = $pdo->query("SELECT COUNT(DISTINCT device_id) as devices FROM api_logs"); $uniqueDevices = $stmt->fetch()['devices']; $stmt = $pdo->query(" SELECT COUNT(*) as requests FROM api_logs WHERE timestamp >= DATE_SUB(NOW(), INTERVAL 24 HOUR) "); $requests24h = $stmt->fetch()['requests']; ?>
Total API Requests
Unique Devices
Requests (24h)
| Timestamp | Device ID | IP Address | Endpoint | Method | Status | User Agent |
|---|---|---|---|---|---|---|
...
|
|
= 400) { $statusClass = 'badge-danger'; } elseif ($log['response_code'] >= 300) { $statusClass = 'badge-warning'; } ?> | ||||
|
No API requests logged yet. |
||||||