public static function findByURL(CNabuSite $nb_site, string $target_url)
    {
        $retval = null;

        if ($nb_site->isPublicBasePathEnabled()) {
            $check_pbp = CNabuEngine::getEngine()->getMainDB()->getQueryAsSingleField(
                'nb_site_lang_public_base_path',
                "SELECT *
                   FROM nb_site_lang
                  WHERE nb_site_id=%site_id\$d
                    AND length(nb_site_lang_public_base_path) > 0
                    AND instr('%url\$s', nb_site_lang_public_base_path)=1
                  LIMIT 1",
                array(
                    'site_id' => $nb_site->getId(),
                    'url' => $target_url
                )
            );

            if (strlen($check_pbp) > 0) {
                $target_url = substr($target_url, strlen($check_pbp));
            } else {
                $target_url = null;
            }
        }

        if ($target_url !== null) {
            $retval = CNabuSiteTarget::buildObjectFromSQL(
                    "SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
                       FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
                      WHERE ca.nb_site_target_id = cal.nb_site_target_id
                        AND ca.nb_site_id=%site_id\$d
                        AND ca.nb_site_id=sl.nb_site_id
                        AND sl.nb_site_lang_enabled='T'
                        AND cal.nb_language_id=sl.nb_language_id
                        AND ca.nb_site_target_url_filter='U'
                        AND cal.nb_site_target_lang_url='%url\$s'
                      LIMIT 1",
                    array('site_id' => $nb_site->getId(), 'url' => $target_url)
                )

                ??

                CNabuSiteTarget::buildObjectFromSQL(
                    "SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
                       FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
                      WHERE ca.nb_site_target_id = cal.nb_site_target_id
                        AND ca.nb_site_id=%site_id\$d
                        AND ca.nb_site_id=sl.nb_site_id
                        AND sl.nb_site_lang_enabled='T'
                        AND cal.nb_language_id=sl.nb_language_id
                        AND ca.nb_site_target_url_filter='R'
                        AND length(cal.nb_site_target_lang_url)>0
                        AND '%url\$s' REGEXP cal.nb_site_target_lang_url
                      ORDER BY ca.nb_site_target_order ASC
                      LIMIT 1",
                    array('site_id' => $nb_site->getValue('nb_site_id'), 'url' => $target_url)
                )

                ??

                CNabuSiteTarget::buildObjectFromSQL(
                    "SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
                       FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
                      WHERE ca.nb_site_target_id = cal.nb_site_target_id
                        AND ca.nb_site_id=%site_id\$d
                        AND ca.nb_site_id=sl.nb_site_id
                        AND sl.nb_site_lang_enabled='T'
                        AND cal.nb_language_id=sl.nb_language_id
                        AND ca.nb_site_target_url_filter='L'
                        AND length(cal.nb_site_target_lang_url)>0
                        AND '%url\$s' LIKE cal.nb_site_target_lang_url
                      ORDER BY ca.nb_site_target_order ASC
                      LIMIT 1",
                    array('site_id' => $nb_site->getId(), 'url' => $target_url)
                )
            ;
        }

        if ($retval !== null) {
            $retval->setSite($nb_site);
        }

        return $retval;
    }