Gets the previous page, respecting sort order
322641
def previous(self):
        
        if self._order_by == 'oldest':
            return self.older
        if self._order_by == 'newest':
            return self.newer
        return None
653952
def _previous_pages_count(self):
        ''
        skip = self.skip
        if skip == 0:
            return 0
        count, remainder = divmod(skip, self.limit)
        return count
702853
def get_pages(self, label=None):
        """"""
        return (
            page for page in sorted(
                self._pages.values(), key=lambda i: i.created, reverse=True
            ) if ((not label or label in page.labels) and page.visible)
        )
1331528
def get_page(self, url):
        
        if url:
            data = self.feed._request(url, offset=self._offset, since=self._since, before=self._before)

            # set values to False to avoid using them for next request
            self._before = False if self._before is not None else None
            self._since = False if self._since is not None else None
            if getattr(self.feed, 'issue65', False):
                self._offset = False
            if self._since is not None:
                # we want oldest items first when using 'since'
                return reversed(data['items'])
            else:
                return data['items']
        else:
            return []
247250
def getReturnPage(context, prior=False):
    '''
    
    '''
    siteHistory = getattr(context.get('request',None),'session',{}).get('SITE_HISTORY',{})
    return returnPageHelper(siteHistory,prior=prior)
92365
public void lastPage() {
		int idx = pages.size()-1;
		
		if( idx < 0 ) {
			idx = 0;
		}
		if( pageIndex != idx ) {
			pageIndex = idx;
			currentPage = null;
		}
	}
1161171
@Override
    public Page<User> previousPage(final Page<User> page, 
                                   final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.IPMESSAGING.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
739196
def get_parent_page(self):
        
        if self.current_level == 1:
            # 'root' page
            return None
        else:
            return self.page_data[(self.current_level - 1, self.current_count)]
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
1011808
final protected AbstractIndexPage getPrevLeafPage(AbstractIndexPage indexPage) {
		int pos = getPagePosition(indexPage);
		if (pos > 0) {
			AbstractIndexPage page = getPageByPos(pos-1);
			return page.getLastLeafPage();
		}
		if (getParent() == null) {
			return null;
		}
		//TODO we really should return the last leaf page of the previous inner page.
		//But if they get merged, then we have to shift minimal values, which is
		//complicated. For now we ignore this case, hoping that it doesn't matter much.
		return null;
	}
892425
def list_records_previous_page(self):
        
        uri = self._paging.get("record", {}).get("prev_uri")
        if uri is None:
            raise exc.NoMoreResults("There are no previous pages of records "
                    "to list.")
        return self._list_records(uri)
639226
protected function getPrevious() {
		if ($this->get('page')> 1) {
			return $this->replaceLine($this->get('page') - 1, $this->get('previous'));
		}
		return null;
	}
720744
def advance_page(self):
        # type: () -> List[Model]
        
        if self.next_link is None:
            raise StopIteration("End of paging")
        self._current_page_iter_index = 0
        self._response = self._get_next(self.next_link)
        self._derserializer(self, self._response)
        return self.current_page
1175008
@Override
    public Page<SubscribedTrack> previousPage(final Page<SubscribedTrack> page, 
                                              final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.VIDEO.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
879905
protected function get_firstpage() {
        $pages = $this->load_all_pages();
        if (count($pages) > 0) {
            foreach ($pages as $page) {
                if ((int)$page->prevpageid === 0) {
                    return $page;
                }
            }
        }
        return false;
    }
677479
def getPrevUrl(self, url, data):
        """"""
        prevUrl = None
        if self.prevSearch:
            try:
                prevUrl = self.fetchUrl(url, data, self.prevSearch)
            except ValueError as msg:
                # assume there is no previous URL, but print a warning
                out.warn(u"%s Assuming no previous comic strips exist." % msg)
            else:
                prevUrl = self.prevUrlModifier(prevUrl)
                out.debug(u"Found previous URL %s" % prevUrl)
                getHandler().comicPageLink(self.getName(), url, prevUrl)
        return prevUrl
1149619
protected function sortPages()
    {
        // sort pages
        $order = strtolower($this->getConfig('pages_order'));
        $orderBy = strtolower($this->getConfig('pages_order_by'));

        if (($orderBy !== 'alpha') && ($orderBy !== 'date') && ($orderBy !== 'meta')) {
            return;
        }

        $alphaSortClosure = function ($a, $b) use ($order) {
            if (!empty($a['hidden']) xor !empty($b['hidden'])) {
                return (!empty($a['hidden']) - !empty($b['hidden'])) * (($order === 'desc') ? -1 : 1);
            }

            $aSortKey = (basename($a['id']) === 'index') ? dirname($a['id']) : $a['id'];
            $bSortKey = (basename($b['id']) === 'index') ? dirname($b['id']) : $b['id'];

            $cmp = strcmp($aSortKey, $bSortKey);
            return $cmp * (($order === 'desc') ? -1 : 1);
        };

        if ($orderBy === 'meta') {
            // sort by arbitrary meta value
            $orderByMeta = $this->getConfig('pages_order_by_meta');
            uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order, $orderByMeta) {
                $aSortValue = isset($a['meta'][$orderByMeta]) ? $a['meta'][$orderByMeta] : null;
                $aSortValueNull = ($aSortValue === null);

                $bSortValue = isset($b['meta'][$orderByMeta]) ? $b['meta'][$orderByMeta] : null;
                $bSortValueNull = ($bSortValue === null);

                $cmp = 0;
                if ($aSortValueNull || $bSortValueNull) {
                    $cmp = ($aSortValueNull - $bSortValueNull);
                } elseif ($aSortValue != $bSortValue) {
                    $cmp = ($aSortValue > $bSortValue) ? 1 : -1;
                }

                if ($cmp === 0) {
                    // never assume equality; fallback to alphabetical order
                    return $alphaSortClosure($a, $b);
                }

                return $cmp * (($order === 'desc') ? -1 : 1);
            });
        } elseif ($orderBy === 'date') {
            // sort by date
            uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order) {
                if (!empty($a['hidden']) xor !empty($b['hidden'])) {
                    return $alphaSortClosure($a, $b);
                }

                if (!$a['time'] || !$b['time']) {
                    $cmp = (!$a['time'] - !$b['time']);
                } else {
                    $cmp = ($b['time'] - $a['time']);
                }

                if ($cmp === 0) {
                    // never assume equality; fallback to alphabetical order
                    return $alphaSortClosure($a, $b);
                }

                return $cmp * (($order === 'desc') ? 1 : -1);
            });
        } else {
            // sort alphabetically
            uasort($this->pages, $alphaSortClosure);
        }
    }