class PaginationService (View source)

Constants

MIN_ROWS_PER_PAGE

Lower and upper bounds for a usable page size; shared with UserPreferenceService.

MAX_ROWS_PER_PAGE

ROWS_PER_PAGE_PRESETS

Offered in the page-size dropdowns; any value within the bounds is still honoured.

DEFAULT_ROWS_PER_PAGE

Used when nothing usable was supplied; matches interface.rows_per_page's default.

Methods

__construct(UserPreferenceService|null $userPreferenceService = null)

No description

createPagination(int $totalItems, int $itemsPerPage, int $currentPage)

Create a pagination object with proper validation

int
getUserRowsPerPage(int $defaultRowsPerPage, int|null $userId = null)

Get user preference for items per page with validation

array
getRowsPerPageOptions(int ...$extra)

Page sizes to offer, so the current and configured values are always selectable.

Details

__construct(UserPreferenceService|null $userPreferenceService = null)

No description

Parameters

UserPreferenceService|null $userPreferenceService

Pagination createPagination(int $totalItems, int $itemsPerPage, int $currentPage)

Create a pagination object with proper validation

Parameters

int $totalItems
int $itemsPerPage
int $currentPage

Return Value

Pagination

int getUserRowsPerPage(int $defaultRowsPerPage, int|null $userId = null)

Get user preference for items per page with validation

Parameters

int $defaultRowsPerPage

Default rows per page from config

int|null $userId

User ID to get preferences for

Return Value

int

Validated rows per page value

array getRowsPerPageOptions(int ...$extra)

Page sizes to offer, so the current and configured values are always selectable.

Parameters

int ...$extra

Return Value

array