public function groupUrlsByHost($siteUrls)
    {
        if (empty($siteUrls)) {
            return array();
        }

        $allUrls = array();

        foreach ($siteUrls as $idSite => $urls) {
            $idSite = (int) $idSite;
            foreach ($urls as $url) {
                $urlParsed = @parse_url($url);

                if ($urlParsed === false || !isset($urlParsed['host'])) {
                    continue;
                }

                $host = $this->toCanonicalHost($urlParsed['host']);
                $path = $this->getCanonicalPathFromParsedUrl($urlParsed);

                if (!isset($allUrls[$host])) {
                    $allUrls[$host] = array();
                }

                if (!isset($allUrls[$host][$path])) {
                    $allUrls[$host][$path] = array();
                }

                if (!in_array($idSite, $allUrls[$host][$path])) {
                    $allUrls[$host][$path][] = $idSite;
                }
            }
        }

        foreach ($allUrls as $host => $paths) {
            uksort($paths, array($this, 'sortByPathDepth'));
            $allUrls[$host] = $paths;
        }

        return $allUrls;
    }