diff --git a/src/Module/Core/Infrastructure/ApiPlatform/State/Provider/AuditLogProvider.php b/src/Module/Core/Infrastructure/ApiPlatform/State/Provider/AuditLogProvider.php index cc69e85..c0a4aa2 100644 --- a/src/Module/Core/Infrastructure/ApiPlatform/State/Provider/AuditLogProvider.php +++ b/src/Module/Core/Infrastructure/ApiPlatform/State/Provider/AuditLogProvider.php @@ -68,7 +68,11 @@ final readonly class AuditLogProvider implements ProviderInterface */ private function provideCollection(Operation $operation, array $context): DbalPaginator { - $page = $this->pagination->getPage($context); + // `page` brut peut etre <= 0 (parametre client) → OFFSET negatif → 500 PG + // (`SQLSTATE[22023] OFFSET must not be negative`). API Platform clampe + // `itemsPerPage` au max de la resource mais pas `page` ; on impose un + // minimum a 1 cote provider. + $page = max(1, $this->pagination->getPage($context)); $itemsPerPage = $this->pagination->getLimit($operation, $context); $offset = ($page - 1) * $itemsPerPage; $filters = $this->extractFilters($context['filters'] ?? []);