= ?';
$params[] = $dateFrom . ' 00:00:00';
}
if ($dateTo !== '' && preg_match('/^\d{4}-\d{2}-\d{2}$/', $dateTo)) {
$where[] = 'created_at <= ?';
$params[] = $dateTo . ' 23:59:59';
}
$whereSql = $where ? ('WHERE ' . implode(' AND ', $where)) : '';
$page = max(1, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT) ?: 1);
$perPage = 50;
$offset = ($page - 1) * $perPage;
$countStmt = $db->prepare("SELECT COUNT(*) FROM audit_log $whereSql");
$countStmt->execute($params);
$total = (int)$countStmt->fetchColumn();
$sql = "SELECT id, created_at, admin_username, action, entity_type, entity_id, details
FROM audit_log
$whereSql
ORDER BY created_at DESC
LIMIT $perPage OFFSET $offset";
$stmt = $db->prepare($sql);
$stmt->execute($params);
$entries = $stmt->fetchAll(PDO::FETCH_ASSOC);
$totalPages = max(1, (int)ceil($total / $perPage));
$user = current_admin_username();
function build_query_string(array $overrides): string
{
$base = [
'user' => $_GET['user'] ?? '',
'action' => $_GET['action'] ?? '',
'entity_type' => $_GET['entity_type'] ?? '',
'date_from' => $_GET['date_from'] ?? '',
'date_to' => $_GET['date_to'] ?? '',
'page' => $_GET['page'] ?? 1,
];
$merged = array_merge($base, $overrides);
return http_build_query($merged);
}
?>
Journal d'audit — NetMonster Admin
Journal d'audit
Historique en lecture seule des modifications effectuees dans l'administration. Ce journal ne peut pas etre modifie depuis l'interface.
Entrees (= $total ?>)
| Date |
Utilisateur |
Action |
Entite |
ID |
Details |
| = htmlspecialchars((string)$entry['created_at'], ENT_QUOTES, 'UTF-8') ?> |
= htmlspecialchars((string)$entry['admin_username'], ENT_QUOTES, 'UTF-8') ?> |
= htmlspecialchars((string)$entry['action'], ENT_QUOTES, 'UTF-8') ?> |
= htmlspecialchars((string)$entry['entity_type'], ENT_QUOTES, 'UTF-8') ?> |
= (int)$entry['entity_id'] ?> |
= htmlspecialchars((string)$entry['details'], ENT_QUOTES, 'UTF-8') ?> |
| Aucune entree pour ces filtres. |