CakePHP 4 and the pagination class - initialstate last page

I want to use the Pagination class for my Document entity. I have the following code:

public function index()
{
    $queryParam     = $this->request->getQueryParams();
    $documentsQuery = $this->Documents
        ->find('search', array('search' => $queryParam))
        ->contain(array('Users'));
    $totalDocuments = $documentsQuery->count();
    $defaultLimit = 15;
    $currentPage = ceil($totalDocuments / $defaultLimit);
    $paginationSettings = array(
        'limit' => $defaultLimit,
        'page' => $currentPage,
    );
    $documents = $this->paginate($documentsQuery, $paginationSettings);
    $this->set(compact('documents'));
}

The goal is to always jump to the last page during the initial load. However, I can no longer navigate to the other pages. It seems like the settings are overriding the queries, which is very inconvenient. How do you handle this? Or have I made a conceptual mistake? What would it look like otherwise? It’s important that I always go to the last page in the view with the normal ASC sorting.

Why do you want to redirect in the last page?, You can sort it DESC order

It is nicer and more pleasant if the entries start at 1 and are continued up to the last page. The last page should also have the last entries. Better 1 2 3 instead of 3 2 1.

I have now found a solution, but I fear that line 550 is a bug in the Pagination Helper.
PaginationHelper.php:550

...
        if (!empty($options['page']) && $options['page'] === 1) {
            $options['page'] = null;
        }
...

At least it makes no sense to remove the page query from the first page. Solution: After overloading the method in a separate Paginator Helper, my method now works.

Now my index method looks like this:

	/**
	 * Pagination Default.
	 *
	 * @var array
	 */
	public $paginate = [
        'limit' => 15
    ];

	/**
	 * Index method
	 *
	 * @return \Cake\Http\Response|null|void Renders view
	 */
	public function index()
	{
		$queryParam     = $this->request->getQueryParams();
		$documentsQuery = $this->Documents
			->find('search', array('search' => $queryParam))
			->contain(array('Users'));
		$totalDocuments = $documentsQuery->count();
		$defaultLimit = 15;
		$currentPage = 1;
		if (isset($queryParam['page'])) {
			$currentPage = (int)$queryParam['page'];
		} else {
			$currentPage = ceil($totalDocuments / $defaultLimit);
		}
		$paginationSettings = [
			'page' => $currentPage,
		];
		$documents = $this->paginate($documentsQuery, $paginationSettings);
		$this->set(compact('documents',));
	}

Problem: If you set page as a parameter, the Paginator Helper in its current form cannot set the first page with ?page=1 as a query. See above. If you remove the if, everything works again.