/**
  * Tries to autodetect the target page UID
  *
  * @throws \RuntimeException If the page id can not be determined
  */
 protected function initializePageUid()
 {
     if (isset($this->pageUid)) {
         return;
     }
     /**  @var PageRepository $pageSelect */
     $pageSelect = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $whereStatement = "tt_content.list_type='formhandler_pi1' AND pages.uid=tt_content.pid ";
     $whereStatement .= 'AND tt_content.pi_flexform LIKE \'%<field index="predefined">%<value index="vDEF">formhandler_subscription_remove_subscription.</value>%</field>%\'';
     $whereStatement .= $pageSelect->enableFields('pages');
     $whereStatement .= $pageSelect->enableFields('tt_content');
     $contentResult = $this->typo3Db->exec_SELECTquery('pages.uid', 'pages,tt_content', $whereStatement, '', '', '1');
     if ($contentResult === FALSE) {
         throw new \RuntimeException('Error detecting target PID: ' . $this->typo3Db->sql_error());
     }
     if (!$this->typo3Db->sql_num_rows($contentResult)) {
         throw new \RuntimeException('The target PID could not be detected. No active formhandler plugin content element was found.');
     }
     $row = $this->typo3Db->sql_fetch_row($contentResult);
     $this->pageUid = $row[0];
 }