= 200 && $statusCode < 300) { $statusVariant = 'success'; } elseif ($statusCode >= 400 && $statusCode < 500) { $statusVariant = 'warning'; } elseif ($statusCode >= 500) { $statusVariant = 'danger'; } $queryJson = trim((string) ($auditLog['query_json'] ?? '')); $queryPretty = '-'; if ($queryJson !== '') { $decoded = json_decode($queryJson, true); if (is_array($decoded)) { $pretty = json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); $queryPretty = is_string($pretty) ? $pretty : $queryJson; } else { $queryPretty = $queryJson; } } $userLabel = trim((string) ($auditLog['user_display_name'] ?? '')); $userEmail = trim((string) ($auditLog['user_email'] ?? '')); if ($userLabel === '') { $userLabel = $userEmail !== '' ? $userEmail : '-'; } $tenantLabel = trim((string) ($auditLog['tenant_description'] ?? '')); if ($tenantLabel === '') { $tenantLabel = '-'; } $requestId = trim((string) ($auditLog['request_id'] ?? '')); $method = strtoupper(trim((string) ($auditLog['method'] ?? ''))); $path = trim((string) ($auditLog['path'] ?? '')); $errorCode = trim((string) ($auditLog['error_code'] ?? '')); $ip = trim((string) ($auditLog['ip'] ?? '')); $userAgent = trim((string) ($auditLog['user_agent'] ?? '')); $durationMs = (int) ($auditLog['duration_ms'] ?? 0); $tokenId = (int) ($auditLog['api_token_id'] ?? 0); $tokenTenantId = (int) ($auditLog['token_tenant_id'] ?? 0); ?>