Paginator numbers helper (4x)

I am using this code for pagination links

<nav class="nav_pag">
    <ul class=" pagination justify-content-center">
        <li class="page-item">
            <?php
            echo $this->Paginator->first(__('First', true), array('tag' => 'li', 'escape' => false), array('type' => "button", 'class' => "page-link"));
            echo $this->Paginator->prev('&laquo;', array('tag' => 'li', 'escape' => false), '<a href="#">&laquo;</a>', array('class' => 'prev disabled', 'tag' => 'li', 'escape' => false));
            echo $this->Paginator->numbers(['first' => 1, 'last' => 1],[['separator' => '', 'tag' => 'li', 'currentLink' => true, 'currentClass' => 'active', 'currentTag' => 'a']]);
            echo $this->Paginator->next('&raquo;', array('tag' => 'li', 'escape' => false), '<a href="#">&raquo;</a>', array('class' => 'prev disabled', 'tag' => 'li', 'escape' => false));
            echo $this->Paginator->last(__('Last', true), array('tag' => 'li', 'escape' => false), array('type' => "button", 'class' => "page-link"));
            ?>
    </ul>
</nav>

at mobile for $this->Paginator->numbers i just want to show 2 or max 5 pages link but its showing max 10. How to fix it?

$this->Paginator->numbers([‘first’ => 1, ‘last’ => 1]) is not working.

Thanks

Good day. Maybe you should try setting a limit ?

Here’s my code in my Controller in the index
$data = $this->paginate($this->Data,[‘limit’=> ‘10’]);

It now shows me more pages depending on the contents i have within the pages i have.

i hope it helps