<?php
/**
* @package   Gridbox
* @author    Balbooa http://www.balbooa.com/
* @copyright Copyright @ Balbooa
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/

use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

defined('_JEXEC') or die;

ob_start();
?>
<div class="ba-blog-posts-pagination-wrapper">
    <div class="ba-blog-posts-pagination">
<?php
if ($pagination != '') {
    $style = ($pagination == 'infinity'||$active == $allPages - 1||($pagination == 'load-more-infinity'&&$active > 0))?'style="display:none !important"' : '';
?>
        <span class="<?php echo $active == $allPages - 1 ? 'disabled' : ''; ?>" <?php echo $style; ?>>
            <a href="<?php echo Route::_($url.'&page='.$next); ?>" data-page="<?php echo $next; ?>">
<?php
            echo Text::_('LOAD_MORE');
?>
            </a>
        </span>
<?php
} else {
?>
        <span class="<?php echo $active == 0 ? 'disabled' : ''; ?>">
            <a href="<?php echo Route::_($url.'&page=1'); ?>"
               aria-label="<?php echo Text::_('NAVIGATE_TO_FIRST_PAGE'); ?>"
               data-page="1">
                <i class="ba-icons ba-icon-skip-previous"></i>
            </a>
        </span>
        <span class="<?php echo $active == 0 ? 'disabled' : ''; ?>">
            <a href="<?php echo Route::_($url.'&page='.$prev); ?>"
               aria-label="<?php echo Text::_('NAVIGATE_TO_PREVIOUS_PAGE'); ?>"
               data-page="<?php echo $prev; ?>">
                <i class="ba-icons ba-icon-fast-rewind"></i>
            </a>
        </span>
    <?php
        for ($i = $start; $i < $max; $i++) {
    ?>
        <span class="<?php echo $i == $active ? 'active' : ''; ?>">
            <a href="<?php echo Route::_($url.'&page='.($i + 1)); ?>"
               data-page="<?php echo ($i + 1); ?>">
                <?php echo ($i + 1); ?>
            </a>
        </span>
    <?php
        }
    ?>
        <span class="<?php echo $active == $allPages - 1 ? 'disabled' : ''; ?>">
            <a href="<?php echo Route::_($url.'&page='.$next); ?>"
               aria-label="<?php echo Text::_('NAVIGATE_TO_NEXT_PAGE'); ?>"
               data-page="<?php echo $next; ?>">
                <i class="ba-icons ba-icon-fast-forward"></i>
            </a>
        </span>
        <span class="<?php echo $active == $allPages - 1 ? 'disabled' : ''; ?>">
            <a href="<?php echo Route::_($url.'&page='.$allPages); ?>"
               aria-label="<?php echo Text::_('NAVIGATE_TO_LAST_PAGE'); ?>"
               data-page="<?php echo $allPages; ?>">
                <i class="ba-icons ba-icon-skip-next"></i>
            </a>
        </span>
<?php
}
?>
    </div>
</div>
<?php
$out = ob_get_contents();
ob_end_clean();