<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.'); ?>
  <?php if($this->_config->get('jg_showcatcount')): ?>
  <div class="jg_galcountcats">
<?php   if($this->total == 1): ?>
    <?php echo JText::_('JGS_GALLERY_THERE_IS_ONE_CATEGORY_IN_GALLERY'); ?>
<?php   endif;
        if($this->total > 1): ?>
    <?php echo JText::sprintf('JGS_GALLERY_THERE_ARE_CATEGORIES_IN_GALLERY', $this->total); ?>
<?php   endif; ?>
  </div>
<?php endif; ?>
  <div class="pagenav jg_paginationgal">
<?php if($this->totalpages > 1):
        if($this->page != 1): ?>
    <a class="jg_pagination_begin" href="<?php echo JRoute::_('index.php?view=gallery').JHTML::_('joomgallery.anchor', 'gallery'); ?>" class="jg_pagenav">
      &laquo;&laquo;&nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_BEGIN'); ?></a>
<?php   endif;
        if($this->page == 1): ?>
    <span class="jg_pagenav">
      &laquo;&laquo;&nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_BEGIN'); ?>
    </span>
<?php   endif;
        if($this->page - 1 > 0): ?>
    <a class="pagenav_prev jg_pagination_prev" href="<?php echo JRoute::_('index.php?view=gallery&page='.($this->page-1)).JHTML::_('joomgallery.anchor', 'gallery'); ?>" class="jg_pagenav">
      &laquo;&nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_PREVIOUS'); ?></a>
<?php   endif;
        if($this->page - 1 <= 0): ?>
    <span class="pagenav_prev jg_pagination_prev">
      &laquo;&nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_PREVIOUS'); ?>&nbsp;
    </span>
<?php   endif; ?>
    <?php echo JHTML::_('joomgallery.pagination', 'index.php?view=gallery&page=%u', $this->totalpages, $this->page, 'gallery'); ?>
<?php   if($this->page + 1 <= $this->totalpages): ?>
    <a class="pagenav_next jg_pagination_next" href="<?php echo JRoute::_('index.php?view=gallery&page='.($this->page+1)).JHTML::_('joomgallery.anchor', 'gallery'); ?>" class="jg_pagenav">
      &nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_NEXT'); ?>&nbsp;&raquo;</a>
<?php   endif;
        if($this->page + 1 > $this->totalpages): ?>
    <span class="pagenav_next jg_pagination_next">
      &nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_NEXT'); ?>&nbsp;&raquo;
    </span>
<?php   endif;
        if($this->page != $this->totalpages): ?>
    <a class="jg_pagination_end" href="<?php echo JRoute::_('index.php?view=gallery&page='.$this->totalpages).JHTML::_('joomgallery.anchor', 'gallery'); ?>" class="jg_pagenav">
      &nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_END'); ?>&nbsp;&raquo;&raquo;</a>
<?php   endif;
        if($this->page == $this->totalpages): ?>
    <span class="jg_pagination_end">
      &nbsp;<?php echo JText::_('JGS_COMMON_PAGENAVIGATION_END'); ?>&nbsp;&raquo;&raquo;
    </span>
<?php   endif;
      endif; ?>
  </div>
