mdn-backend / app /Shared /Validation /PaginationValidator.php
internationalscholarsprogram's picture
feat(membership): admin-driven account creation, real estate tier/investment work, in-progress monorepo migration state
b2dcf0f
Raw
History Blame Contribute Delete
400 Bytes
<?php
namespace App\Shared\Validation;
class PaginationValidator
{
public function normalize(array $input): array
{
$page = max(1, (int) ($input['page'] ?? 1));
$perPage = min(100, max(1, (int) ($input['per_page'] ?? 25)));
return [
'page' => $page,
'per_page' => $perPage,
'offset' => ($page - 1) * $perPage,
];
}
}