in controller
$psch = $this->request->getQuery('psch', '');
$aval = $this->request->getQuery('aval', '');
$query = $this->Dogs->find()
->where([
'dogname LIKE' => $psch . '%'
])
->orderDesc('lastedit');
if (in_array($aval, ['y', 'n'], true)) {
$query->where([
'adopted' => $aval === 'n',
]);
}
$this->paginate = [
'limit' => 5
];
$dogs = $this->paginate($query);
$this->set([
'dogs' => $dogs
]);
in view template
<td><?= $this->Html->link('available chiuauas', [
'?' => [
'psch' => 'chiuaua',
'aval' => 'y'
]
]) ?></td>
EDIT
most of paginatior helper functions can take ‘url’ as option::
<?= $this->Paginator->numbers([
'url' => [
'?' => [
'psch' => 'a',
'aval' => 'n'
]
]
]) ?>