code: 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);
        }
      });
    }
docs: Get the pages selected in the suffix of the URL
  @param filter optional filter to select only specific pages
  @param basePage the suffix path is relative to this page path (null for current page)
  @return a list containing the Pages