title: Get current pageid in TYPO3 v10.4
body: <p>Previously in version 8 and 9, I could access the page id using the following</p>
  <p>$currentPid = $GLOBALS['TSFE']-&gt;id</p>
  <p>I am now updating my plugin to support 10.4, the above snippet gives out a null value. How can I access the page id and then also the root of the page id. I need the root page to gather the typoscript info from the root template.</p>
  <pre><code>    $currentPage = $GLOBALS['TSFE']-&gt;id;
  
          if ($currentPage === null) {
              
              $localTSFE = clone $GLOBALS['TSFE'];    
              if (version_compare($typo3Branch, '9.5', '&gt;=')) {
                  $localTSFE-&gt;fe_user = GeneralUtility::makeInstance(FrontendUserAuthentication::class);
              }
              $localTSFE-&gt;determineId();
              $currentPage = $localTSFE-&gt;id;
          }
      
          
          $rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $currentPage)-&gt;get();
          
          $templateService-&gt;start($rootLine);
  
          $setup = $templateService-&gt;setup;
          return $setup;
  </code></pre>
  <p>After the first line the currentPage is being set to null.
  Then an error is being thrown when cloning the $GLOBALS['TSFE'].<br />
  Error: _clone on non-object</p>