1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
require_once __DIR__ . '/config.php';
$hash = $_GET['hash'] ?? '';
if (!$hash) error_response('Missing hash parameter');
$errors = load_json(ERRORS_FILE);
$sessions = load_json(SESSIONS_FILE);
$matches = array_filter($errors, fn($e) => ($e['hash'] ?? '') === $hash);
$matches = array_values($matches);
if (empty($matches)) {
error_response('Error not found', 404);
}
$totalCount = array_sum(array_column($matches, 'count'));
$uniqueSessions = array_unique(array_column($matches, 'session_id'));
$firstSeen = min(array_column($matches, 'first_seen'));
$lastSeen = max(array_column($matches, 'last_seen'));
json_response([
'success' => true,
'hash' => $hash,
'total_occurrences' => count($matches),
'total_count' => $totalCount,
'unique_sessions' => count($uniqueSessions),
'first_seen' => $firstSeen,
'last_seen' => $lastSeen,
'type' => $matches[0]['type'] ?? 'unknown',
'severity' => $matches[0]['severity'] ?? 'error',
'category' => $matches[0]['category'] ?? 'runtime',
'sample_message' => $matches[0]['message'] ?? '',
'sample_stack' => $matches[0]['stack'] ?? null,
'occurrences' => array_slice($matches, 0, 20),
]);
|