badgeVariant(); $metadataJson = trim((string) ($auditLog['metadata_json'] ?? '')); $metadataPretty = '-'; if ($metadataJson !== '') { $decoded = json_decode($metadataJson, true); if (is_array($decoded)) { $pretty = json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); $metadataPretty = is_string($pretty) ? $pretty : $metadataJson; } else { $metadataPretty = $metadataJson; } } $requestId = trim((string) ($auditLog['request_id'] ?? '')); $eventType = trim((string) ($auditLog['event_type'] ?? '')); $channel = strtoupper(trim((string) ($auditLog['channel'] ?? ''))); $errorCode = trim((string) ($auditLog['error_code'] ?? '')); $method = strtoupper(trim((string) ($auditLog['method'] ?? ''))); $path = trim((string) ($auditLog['path'] ?? '')); $targetType = trim((string) ($auditLog['target_type'] ?? '')); $targetUuid = trim((string) ($auditLog['target_uuid'] ?? '')); $ipHash = trim((string) ($auditLog['ip_hash'] ?? '')); $userAgentHash = trim((string) ($auditLog['user_agent_hash'] ?? '')); $actorLabel = trim((string) ($auditLog['actor_user_display_name'] ?? '')); $actorEmail = trim((string) ($auditLog['actor_user_email'] ?? '')); if ($actorLabel === '') { $actorLabel = $actorEmail !== '' ? $actorEmail : '-'; } $tenantLabel = trim((string) ($auditLog['actor_tenant_description'] ?? '')); if ($tenantLabel === '') { $tenantLabel = '-'; } ?>