Protected page row number for last link
17423
protected function calculatePageRowNumberForLastLink()
    {
        $mod = $this->totalRows % $this->limit;

        return ($this->totalRows - $mod ) - ($mod == 0 ? $this->limit : 0);
    }
489582
def end_index(self):
        """"""
        paginator = self.paginator
        # Special case for the last page because there can be orphans.
        if self.number == paginator.num_pages:
            return paginator.count
        return (self.number - 1) * paginator.per_page + paginator.first_page
1091335
def get_page_numbers(current_page, num_pages):
    

    if current_page <= 2:
        start_page = 1
    else:
        start_page = current_page - 2

    if num_pages <= 4:
        end_page = num_pages
    else:
        end_page = start_page + 4
        if end_page > num_pages:
            end_page = num_pages

    pages = []
    if current_page != 1:
        pages.append('first')
        pages.append('previous')
    pages.extend([i for i in range(start_page, end_page + 1)])
    if current_page != num_pages:
        pages.append('next')
        pages.append('last')
    return pages
1036722
function () {
            var prevPageIndex,
                currentPageIndex,
                rowIndex,
                row,
                offset,
                state = this.state,
                pages = state.pages;

            prevPageIndex = util.bisectRight(pages, state.scrollTop, 'y0') - 1;
            if (prevPageIndex < 0) {
                return 1;
            }
            offset = state.scrollTop + pages[prevPageIndex].height / 2;
            currentPageIndex = util.bisectRight(pages, offset, 'y0') - 1;
            rowIndex = pages[currentPageIndex].rowIndex;
            row = state.rows[rowIndex];
            return 1 + row[0];

        }
315983
protected function addPrevLink($startRowNumber, &$prevLink)
    {
        $prevLink = $this->getLink($this->decrementPageRowNumber($startRowNumber), $this->getStyleClassAttributes('prev'), $this->prevName);
    }
466664
protected function getPaginationData()
	{
		// Choose page range ( window ) and set start/end page range.
		$this->setPageRange();

		// Set previous/next page number.
		$this->setPrevNumPage();
		$this->setNextNumPage();

		$pagination['template']		= $this->layout_template;
		$pagination['items_total'] 	= $this->getNumTotalResults();
		$pagination['item_start']		= ( ( $this->prev_num_page * $this->items_per_page ) + 1 );
		$pagination['item_end']		= ( $this->current_page_number * $this->items_per_page );
		$pagination['params']			= $this->params_template;
		if ( $pagination['item_end'] > $this->getNumTotalResults() )
		{
			$pagination['item_end'] = $this->getNumTotalResults();
		}
		$pagination['num_pages']		= $this->num_pages;
		$pagination['current_page']	= $this->current_page_number;

		// Links.
		for ( $i = $this->start_page_range; $i<= $this->end_page_range; $i++ )
		{
			$pagination['pages'][$i]['number']		= (int)$i;
		 	$pagination['pages'][$i]['is_current'] 	= ( $i == $this->current_page_number );

		 	$pagination['pages'][$i]['link'] 		= $this->url_base;
		 	if ( 1 != $i )
		 	{
		 		$pagination['pages'][$i]['link'] 	= $this->url_base . $this->separator_link_page . $i;
		 	}

		}

		if ( $this->prev_num_page > 0 )
		{
			$pagination['previous_page']['number'] 	= $this->prev_num_page;

			$pagination['previous_page']['link'] 		= $this->url_base;
			if ( 1 != $this->prev_num_page )
			{
				$pagination['previous_page']['link'] = $this->url_base . $this->separator_link_page . $this->prev_num_page;
			}
		}

		if ( $this->next_num_page > 0 )
		{
			$pagination['next_page']['number'] 		= $this->next_num_page;
			$pagination['next_page']['link'] 			= $this->url_base . $this->separator_link_page . $this->next_num_page;;
		}

		if ( 1 != $this->current_page_number )
		{
			$pagination['first_page']['number'] 		= 1;
			$pagination['first_page']['link'] 		= $this->url_base;
		}

		if ( $this->num_pages != $this->current_page_number )
		{
			$pagination['last_page']['number']	 	= $this->num_pages;
			$pagination['last_page']['link'] 			= $this->url_base . $this->separator_link_page . $this->num_pages;
		}

		$pagination['items_per_page'] 		= $this->items_per_page;
		$pagination['display_items_per_page'] = $this->display_items_per_page;

		return $pagination;
	}
1371354
def previous_page(params = {}, opts = {})
      first_id = data.first.id

      params = filters.merge(ending_before: first_id).merge(params)

      list(params, opts)
    end
414551
def url_params_previous_page(self):
        

        self.assert_has_previous_page()

        params = {self.PARAM_OLDER_ID: str(self.older_id)}
        self._add_count_to_params_if_needed(params)

        return params
128018
def get_last_content(request, page_id):
    """"""
    content_type = request.GET.get('content_type')
    language_id = request.GET.get('language_id')
    page = get_object_or_404(Page, pk=page_id)
    placeholders = get_placeholders(page.get_template())
    _template = template.loader.get_template(page.get_template())
    for placeholder in placeholders:
        if placeholder.name == content_type:
            context = RequestContext(request, {
                'current_page': page,
                'lang': language_id
            })
            with context.bind_template(_template.template):
                content = placeholder.render(context)
                return HttpResponse(content)
    raise Http404
1074267
def next_page(params = {}, opts = {})
      return self.class.empty_list(opts) unless has_more
      last_id = data.last.id

      params = filters.merge(starting_after: last_id).merge(params)

      list(params, opts)
    end
165488
private String pubMedURL(int rowIndex){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
        }

        final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
        final String title = currentRecord.getValueByFieldName(params[0]);
        String pubMedId = currentRecord.getValueByFieldName(params[1]);

        if (pubMedId.isEmpty()){
            return title;
        }

        String result = "<a href=" + "http://www.ncbi.nlm.nih.gov/pubmed/"+pubMedId+" target=_blank>"+title+"</a>";
        return result;
    }
167891
function canPageForward () {
    var elements = getElements();
    var lastTab = elements.tabs[ elements.tabs.length - 1 ];

    if (isRtl()) {
      return ctrl.offsetLeft < elements.paging.offsetWidth - elements.canvas.offsetWidth;
    }

    return lastTab && lastTab.offsetLeft + lastTab.offsetWidth > elements.canvas.clientWidth +
        ctrl.offsetLeft;
  }
679177
@XmlElement(name = "lastPageLink")
    @JsonProperty(value = "lastPageLink")
    @ApiModelProperty(value = "The last pagination link.", position = 5)
    public PageRequestLinkDto getLastPageLink() {
        return lastPageLink;
    }
120075
function getSelectedRowsLength(wwe) {
  const selectionMgr = wwe.componentManager.getManager('tableSelection');
  const $selectedCells = selectionMgr.getSelectedCells();
  let length = 1;

  if ($selectedCells.length > 1) {
    const first = $selectedCells.first().get(0);
    const last = $selectedCells.last().get(0);
    const range = selectionMgr.getSelectionRangeFromTable(first, last);
    length = range.to.row - range.from.row + 1;
  }

  return length;
}
1185285
function (pageNum) {
            var textPath = util.template(config.template.html, { page: pageNum });
            return config.url + textPath + config.queryString;
        }
1284429
def paginate(idx, max, url, &b)
      return '' if max == 0
      url = url.gsub(%r{^/?(.*?)/?$}, '\1')
      b ||= lambda{}
      link = lambda {|*args|
        i, title, text = args
        "<a href=\"/#{url}/#{i}#{'?' + @query_string if @query_string}\" " +
         "#{'onclick="return false;"' if (i == idx)} " +
         "class=\"#{'disabled ' if (i == idx)}#{b.call(i)}\" " +
         "title=\"#{title||"Go to page #{i}"}\">#{text||i}</a>"
      }
      res = '<div class="nav">'
      if (idx > 0)
        res << link.call(idx - 1, "Go to previous page", "&#171; Previous")
      else
        res << "<a href=\"/#{url}/0\" onclick=\"return false;\" " +
                "class=\"disabled\" title=\"Disabled\">&#171; Previous</a>"
      end
      if idx < 10
        idx.times {|i| res << link.call(i)}
      else
        (0..2).each {|i| res << link.call(i)}
        res << '&nbsp;&#8230;&nbsp;'
        ((idx-4)...idx).each {|i| res << link.call(i)}
      end
      res << link.call(idx, 'Current Page')
      if idx > (max - 10)
        ((idx+1)...max).each {|i| res << link.call(i)}
      else
        ((idx+1)..(idx+4)).each {|i| res << link.call(i)}
        res << '&nbsp;&#8230;&nbsp;'
        ((max-3)...max).each {|i| res << link.call(i)}
      end
      if (idx < (max - 1))
        res << link.call(idx + 1, "Go to next page", "Next &#187;")
      else
        res << "<a href=\"/#{url}/#{max-1}\" onclick=\"return false;\" " +
                "class=\"disabled\" title=\"Disabled\"}\">Next &#187;</a>"
      end
      res << '</div>'
    end
46288
def _set_lastpage(self):
        """"""
        self.last_page = (len(self._page_data) - 1) // self.screen.page_size