/**
  * Attempts to find the page inside the root page that has the given path.
  *
  * @param int $rootPid
  * @param string $url
  * @return array Key 0 is pid (or 0), key 2 is empty string
  */
 protected function findPageByPath($rootPid, $url)
 {
     $pages = $this->fetchPagesForPath($url);
     foreach ($pages as $key => $page) {
         if (!$this->isAnyChildOf($page['pid'], $rootPid)) {
             unset($pages[$key]);
         }
     }
     if (count($pages) > 1) {
         $idList = array();
         foreach ($pages as $page) {
             $idList[] = $page['uid'];
         }
         // No need for hsc() because TSFE does that
         $this->pObj->decodeSpURL_throw404(sprintf('Multiple pages exist for path "%s": %s', $url, implode(', ', $idList)));
     }
     reset($pages);
     $page = current($pages);
     return array($page['uid'], '');
 }