code: private String getRootPath(String path, int rootLevel, ResourceResolver resourceResolver) {
      String rootPath = Path.getAbsoluteParent(path, rootLevel, resourceResolver);
  
      // strip off everything after first "." - root path may be passed with selectors/extension which is not relevant
      if (StringUtils.contains(rootPath, ".")) {
        rootPath = StringUtils.substringBefore(rootPath, ".");
      }
  
      return rootPath;
    }
docs: Gets site root level path of a site.
  @param path Path of page within the site
  @param rootLevel Level of root page
  @param resourceResolver Resource resolver
  @return Site root path for the site. The path is not checked for validness.