original_string: public function sanitize($url)
      {
          try {
              $url = Router::url($url);
          } catch (\Exception $ex) {
              return '';
          }
  
          if (!str_starts_with($url, '/')) {
              return $url;
          }
  
          if (str_starts_with($url, $this->baseUrl())) {
              $url = str_replace_once($this->baseUrl(), '', $url);
          }
  
          return $this->localePrefix($url);
      }
code: public function sanitize($url)
      {
          try {
              $url = Router::url($url);
          } catch (\Exception $ex) {
              return '';
          }
  
          if (!str_starts_with($url, '/')) {
              return $url;
          }
  
          if (str_starts_with($url, $this->baseUrl())) {
              $url = str_replace_once($this->baseUrl(), '', $url);
          }
  
          return $this->localePrefix($url);
      }
code_tokens: public function sanitize ( $ url ) { try { $ url = Router :: url ( $ url ) ; } catch ( \ Exception $ ex ) { return '' ; } if ( ! str_starts_with ( $ url , '/' ) ) { return $ url ; } if ( str_starts_with ( $ url , $ this -> baseUrl ( ) ) ) { $ url = str_replace_once ( $ this -> baseUrl ( ) , '' , $ url ) ; } return $ this -> localePrefix ( $ url ) ; }
docstring: Sanitizes the given URL by making sure it's suitable for menu links.
  
  @param string $url Item's URL to sanitize
  @return string Valid URL, empty string on error
docstring_tokens: Sanitizes the given URL by making sure it s suitable for menu links .