<?php
$queryStr =$this->common()->pagesQuery();
$action = isset($this->action) ? ['action' => $this->action] : [];
?>
<?php if ($this->pageCount): ?>
    <ul class="pagination pagination-sm no-margin pull-right">
        <?php if (isset($this->previous)): ?>
            <li><a href="<?= $this->url($this->route, $action, ['query'=>['page'=>1]]) . $queryStr; ?>"><<</a></li>
            <li><a href="<?= $this->url($this->route, $action, ['query'=>['page'=>$this->previous]]) . $queryStr; ?>"><</a></li>
        <?php else: ?>
            <li class="disabled"><a href="#"><<</a></li>
            <li class="disabled"><a href="#"><</a></li>
        <?php endif; ?>

        <?php foreach ($this->pagesInRange as $page): ?>
            <?php if ($page != $this->current): ?>
                <li><a href="<?= $this->url($this->route, $action, ['query'=>['page'=>$page]]) . $queryStr; ?>"><?= $this->escapeHtml($page); ?></a></li>
            <?php else: ?>
                <li class="active"><a href="#"><?= $this->escapeHtml($page); ?></a></li>
            <?php endif; ?>

        <?php endforeach; ?>

        <?php if (isset($this->next)): ?>
            <li><a href="<?php echo $this->url($this->route, $action, ['query'=>['page'=>$this->next]]) . $queryStr; ?>">></a></li>
            <li><a href="<?php echo $this->url($this->route, $action, ['query'=>['page'=>$this->pageCount]]) . $queryStr; ?>">>></a></li>
        <?php else: ?>
            <li class="disabled"><a href="#">></a></li>
            <li class="disabled"><a href="#">>></a></li>
        <?php endif; ?>
    </ul>
<?php endif; ?>