aboutsummaryrefslogtreecommitdiff
path: root/api/debug/errors.php
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-07-29 20:46:12 +0200
committerAgando <roduccomm@gmail.com>2026-07-29 20:46:12 +0200
commit0003ad95fa091353827198d0a45cd63a3784479f (patch)
tree4ea79302c13f34b2f1b84a56ed33cc149cd99a21 /api/debug/errors.php
parentcf7461ffeb4f53f3f50c9c692a2e4fdcecf17e82 (diff)
auto: 2026-07-29_20:50 changes — gunes sponsorluk page, bunq payment modal, AI platforms, news W30
Diffstat (limited to 'api/debug/errors.php')
-rw-r--r--api/debug/errors.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/api/debug/errors.php b/api/debug/errors.php
new file mode 100644
index 0000000..1ed9a2f
--- /dev/null
+++ b/api/debug/errors.php
@@ -0,0 +1,43 @@
+<?php
+require_once __DIR__ . '/config.php';
+
+$errors = load_json(ERRORS_FILE);
+
+// Filters
+$type = $_GET['type'] ?? null;
+$severity = $_GET['severity'] ?? null;
+$module = $_GET['module'] ?? null;
+$category = $_GET['category'] ?? null;
+$search = $_GET['search'] ?? null;
+$from = $_GET['from'] ?? null;
+$to = $_GET['to'] ?? null;
+$session = $_GET['session'] ?? null;
+$page = max(1, (int)($_GET['page'] ?? 1));
+$perPage = min(100, max(1, (int)($_GET['per_page'] ?? 50)));
+
+$filtered = array_filter($errors, function($e) use ($type, $severity, $module, $category, $search, $from, $to, $session) {
+ if ($type && ($e['type'] ?? '') !== $type) return false;
+ if ($severity && ($e['severity'] ?? '') !== $severity) return false;
+ if ($module && ($e['module'] ?? '') !== $module) return false;
+ if ($category && ($e['category'] ?? '') !== $category) return false;
+ if ($session && ($e['session_id'] ?? '') !== $session) return false;
+ if ($search && stripos($e['message'] ?? '', $search) === false) return false;
+ if ($from && ($e['ingested_at'] ?? '') < $from) return false;
+ if ($to && ($e['ingested_at'] ?? '') > $to) return false;
+ return true;
+});
+
+$filtered = array_values($filtered);
+$total = count($filtered);
+$totalPages = max(1, ceil($total / $perPage));
+$offset = ($page - 1) * $perPage;
+$pageErrors = array_slice($filtered, $offset, $perPage);
+
+json_response([
+ 'success' => true,
+ 'total' => $total,
+ 'page' => $page,
+ 'per_page' => $perPage,
+ 'total_pages' => $totalPages,
+ 'errors' => $pageErrors,
+]);