<?php $links = $pager->getPageLinks() ?>

<?php if (!empty($links['adjacent']) ? count($links['adjacent']) > 1 : false): ?>
<div class="pager">
    <ul>
        <li class="<?php echo $links['first']['class']?>">
            <a href="<?php echo htmlspecialchars($links['first']['href']) ?>"><< Первая</a>
        </li>
        <?php if (!empty($links['previous'])): ?>
            <li class="<?php echo $links['previous']['class']?>">
                <a href="<?php echo htmlspecialchars($links['previous']['href'])?>">< Назад</a>
            </li>
        <?php endif; ?>        
        
        <?php if (!empty($links['adjacent'])): ?>
            <?php foreach ($links['adjacent'] as $key => $value): ?>
            <li class="<?php echo $value['class']?>">
                <a href="<?php echo htmlspecialchars($value['href'])?>"><?php echo $key ?></a>
            </li>
            <?php endforeach; ?>
        <?php endif; ?>

        <?php if (!empty($links['next'])): ?>
            <li class="<?php echo $links['next']['class']?>">
                <a href="<?php echo htmlspecialchars($links['next']['href'])?>">Вперёд ></a>
            </li>
        <?php endif; ?>

        <li class="<?php echo $links['last']['class']?>">
            <a href="<?php echo htmlspecialchars($links['last']['href']) ?>">Последняя >></a>
        </li>
    </ul>
</div>
<?php endif; ?>