# PageWindow

> Resolves the bounded slice of an already filtered and ordered collection and builds the paginator exposing it.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Web](/docs/extensions/yii3-debug/reference/web/index.md) › PageWindow

| final readonly class | `Yii3\Debug\Web\PageWindow` |
| --- | --- |
| Source | [`src/Web/PageWindow.php`](https://github.com/yii3/debug/blob/main/src/Web/PageWindow.php#L19) |

Resolves the bounded slice of an already filtered and ordered collection and builds the paginator exposing it.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-limit"></span>`$limit` readonly | `positive-int` | Maximum number of rows exposed on the resolved page. | `PageWindow` |
| <span id="property-offset"></span>`$offset` readonly | `int` | Index of the first row on the resolved page. | `PageWindow` |
| <span id="property-page"></span>`$page` readonly | `positive-int` | One-based resolved page number, clamped to the available pages. | `PageWindow` |
| <span id="property-pageCount"></span>`$pageCount` readonly | `int` | Total number of pages the collection spans. | `PageWindow` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a bounded pagination window from raw query values and the collection size. | `PageWindow` |
| [`paginate()`](#method-paginate) static | Builds the paginator positioned on the page the query values select. | `PageWindow` |

## Method details

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

```php
public function __construct(int $total, string|null $perPage, string|null $page)
```

Creates a bounded pagination window from raw query values and the collection size.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$total` | `int` | Rows in the collection. |
| `$perPage` | `string\|null` | Raw `per-page` query value, or `null` to keep every row on one page. |
| `$page` | `string\|null` | Raw `page` query value, or `null` to start on the first page. |

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

```php
public static function paginate(list<Yii3\Debug\Web\TRow> $rows, string|null $perPage, string|null $page): Yiisoft\Data\Paginator\OffsetPaginator<int, Yii3\Debug\Web\TRow>
```

Builds the paginator positioned on the page the query values select.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$rows` | `list<Yii3\Debug\Web\TRow>` | Rows already filtered and ordered. |
| `$perPage` | `string\|null` | Raw `per-page` query value, or `null` to keep every row on one page. |
| `$page` | `string\|null` | Raw `page` query value, or `null` to start on the first page. |

**Returns**

`Yiisoft\Data\Paginator\OffsetPaginator<int, Yii3\Debug\Web\TRow>`: Paginator clamped to the resolved page.