code: private function getBaseUrl($pageDetails, $path = null, $ignoreSSL = false)
      {
          $url = new UrlBuilder();
  
          // Set the domain (see contao/core#6421)
          if ($pageDetails['domain']) {
              $url->setHost($pageDetails['domain']);
          } else {
              $url->setHost(\Environment::get('host'));
          }
  
          if ($pageDetails['rootUseSSL'] && !$ignoreSSL) {
              $url->setScheme('https');
          } else {
              $url->setScheme('http');
          }
  
          // Make a array for the parts.
          $fullPath   = array();
          $fullPath[] = TL_PATH;
  
          // Get the path.
          if ($path === null) {
              $event = new GenerateFrontendUrlEvent($pageDetails, null, $pageDetails['language'], true);
              $this->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
              $fullPath[] = $event->getUrl();
          } else {
              $fullPath[] = $path;
          }
  
          $url->setPath(implode('/', $fullPath));
  
          return $url;
      }
docs: Get the base URL.
  
  @param string[]    $pageDetails The page details.
  
  @param null|string $path        Additional path settings.
  
  @param bool        $ignoreSSL   If active the system will ignore the 'rootUseSSL' flag.
  
  @return UrlBuilder