v3: search engine, responsive header with compact user menu
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import {
|
||||
PAGINATION_DEFAULT_LIMIT,
|
||||
PAGINATION_MAX_LIMIT,
|
||||
} from "../config.ts";
|
||||
|
||||
/**
|
||||
* Parses page/limit query parameters with sensible defaults and bounds.
|
||||
* page: clamped to [1, ∞)
|
||||
@@ -5,7 +10,7 @@
|
||||
*/
|
||||
export function parsePagination(
|
||||
params: URLSearchParams,
|
||||
defaultLimit = 20,
|
||||
defaultLimit = PAGINATION_DEFAULT_LIMIT,
|
||||
): { page: number; limit: number } {
|
||||
const page = Math.max(
|
||||
1,
|
||||
@@ -16,7 +21,7 @@ export function parsePagination(
|
||||
1,
|
||||
parseInt(params.get("limit") ?? String(defaultLimit)) || defaultLimit,
|
||||
),
|
||||
100,
|
||||
PAGINATION_MAX_LIMIT,
|
||||
);
|
||||
return { page, limit };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user