<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Pager template
 *
 * @see \Magento\Theme\Block\Html\Pager
 */
?>
<?php if ($block->getCollection()->getSize()): ?>

    <?php if ($block->getUseContainer()): ?>
    <div class="pager">
    <?php endif ?>

        <?php if ($block->getShowAmounts()): ?>
        <p class="toolbar-amount">
            <span class="toolbar-number">
            <?php if ($block->getLastPageNum()>1): ?>
                <?php /* @escapeNotVerified */ echo __('Items %1 to %2 of %3 total', $block->getFirstNum(), $block->getLastNum(), $block->getTotalNum()) ?>
            <?php elseif ($block->getTotalNum() == 1): ?>
                <?php /* @escapeNotVerified */ echo __('%1 Item', $block->getTotalNum()) ?>
            <?php else: ?>
                <?php /* @escapeNotVerified */ echo __('%1 Item(s)', $block->getTotalNum()) ?>
            <?php endif; ?>
            </span>
        </p>
        <?php endif ?>

        <?php if ($block->getLastPageNum()>1): ?>
        <nav class="pages" aria-label="<?php /* @escapeNotVerified */ echo __('Page navigation') ?>">
            <ul class=" pagination pagination-sm" aria-labelledby="paging-label" style="margin: 0;">
            <?php if (!$block->isFirstPage()): ?>
                <li class="page-item">
                    <?php $text = $block->getAnchorTextForPrevious() ? $block->getAnchorTextForPrevious() : '';?>
                    <a class="page-link <?php /* @escapeNotVerified */ echo $text ? 'link ' : 'action ' ?> previous"
                       href="<?php /* @escapeNotVerified */ echo $block->getPreviousPageUrl() ?>"
                       title="<?php /* @escapeNotVerified */ echo $text ? $text : __('Previous') ?>"
                       aria-label="<?php /* @escapeNotVerified */ echo $text ? $text : __('Previous') ?>">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
            <?php endif;?>

            <?php if ($block->canShowFirst()): ?>
                <li class="page-item">
                    <a class="page-link" href="<?php /* @escapeNotVerified */ echo $block->getFirstPageUrl() ?>">1</a>
                </li>
            <?php endif;?>

            <?php if ($block->canShowPreviousJump()): ?>
                <li class="page-item">
                    <a class="page-link previous jump" title="" href="<?php /* @escapeNotVerified */ echo $block->getPreviousJumpUrl() ?>">
                        <span aria-hidden="true">&hellip;</span>
                    </a>
                </li>
            <?php endif;?>

            <?php foreach ($block->getFramePages() as $_page): ?>
                <?php if ($block->isPageCurrent($_page)): ?>
                    <li class="page-item active">
                        <span class="page-link"><?php /* @escapeNotVerified */ echo $_page ?> <span class="sr-only">(current)</span></span>
                    </li>
                <?php else: ?>
                    <li class="page-item">
                        <a class=page-link href="<?php /* @escapeNotVerified */ echo $block->getPageUrl($_page) ?>" class="page">
                            <?php /* @escapeNotVerified */ echo $_page ?>
                        </a>
                    </li>
                <?php endif;?>
            <?php endforeach;?>

            <?php if ($block->canShowNextJump()): ?>
                <li class="page-item">
                    <a class="page-link next jump" title="" href="<?php /* @escapeNotVerified */ echo $block->getNextJumpUrl() ?>">
                        <span aria-hidden="true">&hellip;</span>
                    </a>
                </li>
            <?php endif;?>

            <?php if ($block->canShowLast()): ?>
              <li class="page-item">
                  <a class="page-link last" href="<?php /* @escapeNotVerified */ echo $block->getLastPageUrl() ?>">
                      <?php /* @escapeNotVerified */ echo $block->getLastPageNum() ?>
                  </a>
              </li>
            <?php endif;?>

            <?php if (!$block->isLastPage()): ?>
                <li class="page-item pages-item-next">
                    <?php $text = $block->getAnchorTextForNext() ? $block->getAnchorTextForNext() : '';?>
                    <a class="page-link <?php /* @escapeNotVerified */ echo $text ? 'link ' : 'action '?> next"
                       href="<?php /* @escapeNotVerified */ echo $block->getNextPageUrl() ?>"
                       title="<?php /* @escapeNotVerified */ echo $text ? $text : __('Next') ?>"
                       aria-label="<?php /* @escapeNotVerified */ echo $text ? $text : __('Next') ?>">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            <?php endif;?>
            </ul>
        </nav>
        <?php endif; ?>

    <?php if ($block->isShowPerPage()): ?>
        <div class="limiter form-inline">
            <label class="limiter-label" for="limiter"><?php /* @escapeNotVerified */ echo __('Show') ?></label>
            <select id="limiter" data-mage-init='{"redirectUrl": {"event":"change"}}' class="limiter-options form-control">
                <?php foreach ($block->getAvailableLimit() as $_key => $_limit): ?>
                    <option value="<?php /* @escapeNotVerified */ echo $block->getLimitUrl($_key) ?>"<?php if ($block->isLimitCurrent($_key)): ?>
                        selected="selected"<?php endif ?>>
                        <?php /* @escapeNotVerified */ echo $_limit ?>
                    </option>
                <?php endforeach; ?>
            </select>
            <span class="limiter-text"><?php /* @escapeNotVerified */ echo __('per page') ?></span>
        </div>
    <?php endif ?>

    <?php if ($block->getUseContainer()): ?>
    </div>
    <?php endif ?>

<?php endif ?>
