I assume you’re seeing this problem in links that are generated by the PaginatorHelper…
I don’t remember all the details of this fix, but I did find some code where I corrected for it. I even left a comment for my future self! This may give you some clues to follow:
/**
* This tweak fixes a problem where the 'pass' values in a
* request params package won't be included in the output url.
* The pass values must be moved up out of the pass node.
*/
$pass = $params['pass'] ?? [];
$url = $params + $pass;
echo '<ul class="paging-controls">';
echo $this->Paginator->first('<< ', ['url' => $url]);
echo $this->Paginator->prev('< ', ['url' => $url]);
echo $this->Paginator->numbers(['url' => $url]);
echo $this->Paginator->next('>', ['url' => $url]);
echo $this->Paginator->last(' >>', ['url' => $url]);