Calculate page limit and offset.
331115
private function calculatePageLimitAndOffset()
    {
        $pageUri = '';
        $pageUri = Url::segment(3);
        $pageNumber = ($pageUri !== '') ? $pageUri : 0;

        if ($pageNumber) {
            //calculate starting point of pagination
            $start = ($this->getPageNumber() - 1) * $this->perPage;
        } else {
            $start = 0; //set start to 0 by default.
        }

        $this->setPageNumber($pageNumber);
        $this->setPaginationOffset($start);
    }
351992
protected function _offsets()
    {
        if ($display = $this->display) {
            $start  = (int) max($this->current - $display, 1);
            $start  = min($this->count, $start);
            $stop   = (int) min($this->current + $display, $this->count);
        } else { // show all pages
            $start = 1;
            $stop = $this->count;
        }

        $result = array();
        if ($start > 0) {
            foreach (range($start, $stop) as $pagenumber) {
                $result[$pagenumber] =  ($pagenumber-1) * $this->limit;
            }
        }

        return $result;
    }
1039944
def _next_page(self, offset):
        """"""
        self._log.debug("Iterator c_record={}".format(self.c_record))
        page_size = self.page_size
        if (offset + page_size) > self.max_records:
            page_size = self.max_records - offset
        param_dict = self.query_dict.copy()
        param_dict.update(
            {
                'start': str(offset),
                'rows': str(page_size),
                'explainOther': '',
                'hl.fl': '',
            }
        )
        self.res = self.client.search(**param_dict)
        self._num_hits = int(self.res['response']['numFound'])
997783
public function getOffset(){
		if(!empty($this->offset)){
			return $this->offset;
			}
		if($this->type==PTYPE_GET){
			$this->offset=$this->getPage()*$this->getLimit();	
			}
		return $this->offset;
		}
958159
def select_limit(self, table, cols='*', offset=0, limit=MAX_ROWS_PER_QUERY):
        """"""
        return self.fetch(self._select_limit_statement(table, cols, offset, limit))
463329
def limit(count)
      raise InvalidPageSize unless count && count > 0
      Specification.new(reader, result.dup { |r| r.count = count })
    end
641675
protected function calculatePages()
    {
        if ($this->nb_record && $this->total > $this->nb_record) {
            $this->previous_page = $this->nb_page - 1;
            if ($this->previous_page == 0)
                $this->previous_page = false;

            $test = ($this->total / $this->nb_record);
            if ($this->nb_page == intval(ceil($test)))
                $this->next_page = false;
            else
                $this->next_page = $this->nb_page + 1;
        }
    }
806267
function() {
        var w = 0;
        for (var p=0;p<this.pages.length;++p) {
            var cal = this.pages[p];
            w += cal.oDomContainer.offsetWidth;
        }
        if (w > 0) {
            this.oDomContainer.style.width = w + "px";
        }
    }
994647
def paginate(self, request):
        """"""
        return self.collection.offset(self.offset).limit(self.limit)
1256823
def _get_offset(cmd):
    """"""
    dict_offset = cmd.dictionary_page_offset
    data_offset = cmd.data_page_offset
    if dict_offset is None or data_offset < dict_offset:
        return data_offset
    return dict_offset
338491
function () {
            var state = this.state,
                currentPage = state.pages[state.currentPage - 1],
                rowIndex = currentPage.rowIndex,
                prevRow = state.rows[rowIndex - 1];
            return prevRow && prevRow[0] + 1 || state.currentPage;
        }
575442
def pages(self):
        """"""
        if self.per_page == 0 or self.total is None:
            pages = 0
        else:
            pages = int(ceil(self.total / float(self.per_page)))
        return pages
1287549
function () {
            var i, len, page, $page,
                width, height, left, top, paddingH,
                state = this.state,
                viewportWidth = state.viewportDimensions.clientWidth,
                viewportHeight = state.viewportDimensions.clientHeight;
            // update pages so they are centered (preserving margins)
            for (i = 0, len = this.$pages.length; i < len; ++i) {
                $page = this.$pages.eq(i);
                page = state.pages[i];

                if (this.twoPageMode) {
                    paddingH = (i % 2 === 1) ? page.paddingRight : page.paddingLeft;
                } else {
                    paddingH = page.paddingRight + page.paddingLeft;
                }
                width = (page.actualWidth + paddingH) * state.zoomState.zoom;
                height = (page.actualHeight + page.paddingTop + page.paddingBottom) * state.zoomState.zoom;

                if (this.twoPageMode) {
                    left = Math.max(0, (viewportWidth - width * 2) / 2);
                    if (i % 2 === 1) {
                        left += width;
                    }
                } else {
                    left = (viewportWidth - width) / 2;
                }
                top = (viewportHeight - height) / 2;
                left = Math.max(left, 0);
                top = Math.max(top, 0);
                $page.css({
                    marginLeft: left,
                    marginTop: top
                });
            }
        }
73835
function(offset){
            if(arguments.length > 0){
                this.each(function(inx,ele){
                    var node = vQ(ele);
                    var coords = node.offset(),
                        parentOffset = ele.offsetParent.offset(),
                        props = {
                            top: coords.top - parentOffset.top,
                            left: coords.left - parentOffset.left
                        };
                    if (node.css('position') == 'static'){
                        props['position'] = 'relative';
                    }
                    node.css(props);
                });
            }
            if (!this.length) return null;
            if (!vQ.contains(document.documentElement, this[0]))
                return {top: 0, left: 0};
            var obj = this[0].getBoundingClientRect();
            return {
                left: obj.left + window.pageXOffset,
                top: obj.top + window.pageYOffset,
                width: Math.round(obj.width),
                height: Math.round(obj.height)
            };
        }
266260
def page_slice(self):
        """"""
        return (
            None
            if self.query is None
            else (self.query.get("from", 0), self.query.get("size", 10))
        )
404560
def offset(self):
        """"""
        if not self._pages:
            return None

        pos = 0
        for page in self._pages:
            if page is None:
                return None
            if not page.is_final:
                return None
            if not pos:
                pos = page.is_contiguous[0] + page.is_contiguous[1]
                continue
            if pos != page.is_contiguous[0]:
                return None
            pos += page.is_contiguous[1]

        page = self._pages[0]
        offset = page.is_contiguous[0]
        if (page.is_imagej or page.is_shaped) and len(self._pages) == 1:
            # truncated files
            return offset
        if pos == offset + product(self.shape) * self.dtype.itemsize:
            return offset
        return None
1165003
def number_of_pages(self, key, value):
    """"""
    result = maybe_int(force_single_element(value.get('a', '')))
    if result and result > 0:
        return result