Returns only INNER pages.
TODO for now this ignores leafPages on a previous inner node. It returns only leaf pages
from the current node.
@param indexPage
@return The previous leaf page or null, if the given page is the first page.
175694
final protected AbstractIndexPage getPrevInnerPage(AbstractIndexPage indexPage) {
		int pos = getPagePosition(indexPage);
		if (pos > 0) {
			AbstractIndexPage page = getPageByPos(pos-1);
			if (page.isLeaf) {
				return null;
			}
			return page;
		}
		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;
	}
376064
public PaginatedList<Company> list(int page) {
		PaginatedList<Company> results = new PaginatedList<Company>();
		Criteria criteria = this.dao.newCriteria(Company.class).add(Restrictions.eq("deleted", false)).addOrder(Order.asc("name"));
		if (page > 0)
			criteria.setFirstResult((page-1) * PAGESIZE).setMaxResults(PAGESIZE);
		Criteria counting = this.dao.newCriteria(Company.class).setProjection(Projections.countDistinct("id"))
				.add(Restrictions.eq("deleted", false));
		results.setList(this.dao.findByCriteria(criteria, Company.class));
		results.setTotal((Long) counting.uniqueResult());
		return results;
	}
183244
private int getTotalLandscapePointsInPage(CriterionBidLandscapePage page) {
    if (page.getEntries() == null) {
      return 0;
    }
    int totalLandscapePointsInPage = 0;
    for (CriterionBidLandscape criterionBidLandscape : page.getEntries()) {
      totalLandscapePointsInPage += criterionBidLandscape.getLandscapePoints().length;
    }
    return totalLandscapePointsInPage;
  }
883119
@XmlElementWrapper(name = "pages")
  @XmlElement(name = "page", type = Page.class)
  public List<Page> getPages() {
    return pages;
  }
550881
@Override
    public Page<FaxMedia> previousPage(final Page<FaxMedia> page, 
                                       final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.FAX.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
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);
    }
497854
@Override
    public Page<Entity> previousPage(final Page<Entity> page, 
                                     final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.AUTHY.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
688120
final public int getPageIndexInParent(WebSiteRequest req) throws IOException, SQLException {
		WebPage[] myPages=getParent().getCachedPages(req);
		int len=myPages.length;
		for(int c=0;c<len;c++) if(myPages[c].equals(this)) return c;
		throw new RuntimeException("Unable to find page index in parent.");
	}
993618
@Override
    public Page<DataSession> previousPage(final Page<DataSession> page, 
                                          final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.WIRELESS.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
541771
@Override
    public Page<UsageRecord> nextPage(final Page<UsageRecord> page, 
                                      final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getNextPageUrl(
                Domains.WIRELESS.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
1339282
public List<Page> getCurrentPageSequence() {
        ArrayList<Page> flattened = new ArrayList<Page>();
        mRootPageList.flattenCurrentPageSequence(flattened);
        return flattened;
    }
422857
public @NotNull List<Page> getPages(@Nullable final Predicate<Page> filter, @Nullable final Page basePage) {
    Resource baseResourceToUse = null;

    // detect pages page to use
    if (basePage == null) {
      PageManager pageManager = AdaptTo.notNull(request.getResourceResolver(), PageManager.class);
      Page currentPage = pageManager.getContainingPage(request.getResource());
      if (currentPage != null) {
        baseResourceToUse = currentPage.adaptTo(Resource.class);
      }
    }
    else {
      baseResourceToUse = basePage.adaptTo(Resource.class);
    }

    // filter pages (as resources)
    Predicate<Resource> resourceFilter = new Predicate<Resource>() {
      @Override
      public boolean test(Resource resource) {
        Page page = resource.adaptTo(Page.class);
        if (page == null) {
          return false;
        }
        if (filter == null) {
          return true;
        }
        return filter.test(page);
      }
    };
    List<Resource> resources = getResourcesWithBaseResource(resourceFilter, baseResourceToUse);

    // convert resources back to pages
    return Lists.transform(resources, new Function<Resource, Page>() {
      @Override
      @SuppressWarnings("null")
      public Page apply(@Nullable Resource resource) {
        return resource.adaptTo(Page.class);
      }
    });
  }
1182310
public function findAncestors(Page $root, Page $page) : ObjectCollection
    {
        $pages = new ObjectCollection;

        foreach ($root->getDescendants() as $item)
        {
            if (!($item->getLeftValue() >= $page->getLeftValue() && $item->getRightValue() <= $page->getRightValue()))
            {
                $pages->append($item);
            }
        }

        $tree = $this->nestedSet->getTree($pages, $root->getTreeLeft(), $root->getTreeRight());
        $pages = $this->nestedSet->getFlatCollection($tree);

        return $pages;
    }
566735
@SuppressWarnings("unchecked")
    public List<Page> getPermittedChildren(Page page)
    {
        return gpUtil.getContentPermissionManager().getPermittedChildren(page, getRemoteUser());
    }
435251
public final WebPage getRootPage() throws IOException, SQLException {
		WebPage page = this;
		WebPage parent;
		while ((parent = page.getParent()) != null) page = parent;
		return page;
	}
1206202
@Override
	public <S extends T> Page<S> findAll(final Example<S> example, final Pageable pageable) {
		final ArangoCursor cursor = findAllInternal(pageable, example, new HashMap());
		final List<T> content = cursor.asListRemaining();
		return new PageImpl<>((List<S>) content, pageable, cursor.getStats().getFullCount());
	}
226372
@Override
    public Page<MessageInteraction> nextPage(final Page<MessageInteraction> page, 
                                             final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getNextPageUrl(
                Domains.PROXY.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }