# PageSize

> Resolves the per-page grid page size and renders the shared page-size selector.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Data](/docs/extensions/debug-core/reference/data/index.md) › PageSize

| final class | `PHPForge\Debug\Data\PageSize` |
| --- | --- |
| Source | [`src/Data/PageSize.php`](https://github.com/php-forge/debug-core/blob/main/src/Data/PageSize.php#L17) |

Resolves the `per-page` grid page size and renders the shared page-size selector.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`current()`](#method-current) static | Returns the `per-page` selector state, canonicalizing `all` and falling back to the default. | `PageSize` |
| [`resolve()`](#method-resolve) static | Resolves the raw `per-page` value into an effective page size. | `PageSize` |
| [`selectorFor()`](#method-selectorFor) static | Renders the page-size selector for the `per-page` value found in the query parameters. | `PageSize` |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-ALL"></span>`ALL` | `'all'` | Selector value that disables pagination. | `PageSize` |
| <span id="const-DEFAULT"></span>`DEFAULT` | `50` | Default page size applied when no `per-page` parameter is supplied or the value is invalid. | `PageSize` |
| <span id="const-MAX"></span>`MAX` | `1000` | Hard cap on the number of rows per page. | `PageSize` |
| <span id="const-OPTIONS"></span>`OPTIONS` | `['10', '25', '50', '100', self::ALL]` | Selector options in display order; the literal `all` disables pagination. | `PageSize` |

## Method details

### current() <span id="method-current"></span>

```php
public static function current(string|null $raw, int $default = \self::DEFAULT): string
```

Returns the `per-page` selector state, canonicalizing `all` and falling back to the default.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$raw` | `string\|null` | Raw `per-page` query-parameter value, or `null` when absent. |
| `$default` | `int` | Page size used when no value is supplied. |

**Returns**

`string`: Canonical selector value: [`ALL`](/docs/extensions/debug-core/reference/data/pagesize/index.md#const-ALL), the raw value, or the default as a string.

### resolve() <span id="method-resolve"></span>

```php
public static function resolve(string|null $raw, positive-int $default = \self::DEFAULT): positive-int|null
```

Resolves the raw `per-page` value into an effective page size.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$raw` | `string\|null` | Raw `per-page` query-parameter value, or `null` when absent. |
| `$default` | `positive-int` | Page size used when no value is supplied or the value is invalid. |

**Returns**

`positive-int|null`: Effective page size capped at [`MAX`](/docs/extensions/debug-core/reference/data/pagesize/index.md#const-MAX), or `null` when `all` disables pagination.

### selectorFor() <span id="method-selectorFor"></span>

```php
public static function selectorFor(array<array-key, mixed> $queryParams): string
```

Renders the page-size selector for the `per-page` value found in the query parameters.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$queryParams` | `array<array-key, mixed>` | Query parameters already normalized by the panel. |

**Returns**

`string`: Rendered selector markup.