diff --git a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php
index a66410a8ddc80fc7b3b1f2061920a3bacc5e647b..c3f56f896fc9baca3434534a042a27a4da0e08d1 100644
--- a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php
+++ b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php
@@ -1677,14 +1677,14 @@ class PageRepository implements LoggerAwareInterface
      */
     public function versionOL($table, &$row, $unsetMovePointers = false, $bypassEnableFieldsCheck = false)
     {
-        if ($this->versioningWorkspaceId > 0 && is_array($row)) {
+        if ($this->versioningWorkspaceId > 0 && is_array($row) && $row !== [] && isset($row['uid'], $row['t3ver_oid'])) {
             // implode(',',array_keys($row)) = Using fields from original record to make
             // sure no additional fields are selected. This is best for eg. getPageOverlay()
             // Computed properties are excluded since those would lead to SQL errors.
             $fieldNames = implode(',', array_keys($this->purgeComputedProperties($row)));
             // will overlay any incoming moved record with the live record, which in turn
             // will be overlaid with its workspace version again to fetch both PID fields.
-            $incomingRecordIsAMoveVersion = (int)($row['t3ver_oid'] ?? 0) > 0 && (int)($row['t3ver_state'] ?? 0) === VersionState::MOVE_POINTER;
+            $incomingRecordIsAMoveVersion = (int)($row['t3ver_oid']) > 0 && (int)($row['t3ver_state'] ?? 0) === VersionState::MOVE_POINTER;
             if ($incomingRecordIsAMoveVersion) {
                 // Fetch the live version again if the given $row is a move pointer, so we know the original PID
                 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
diff --git a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
index 5dee74777849153c28c067498823b1bc9b9e30dc..ed13d18ebabe4e7417ebcc7f406e8f578cdc0555 100644
--- a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
+++ b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
@@ -650,4 +650,34 @@ final class PageRepositoryTest extends FunctionalTestCase
         self::assertSame('Translated #2', $overlaidRecord['header']);
         self::assertNull($overlaidRecord['bodytext']);
     }
+
+    /**
+     * @return array<string, array{0: array<string, int>}>
+     */
+    public static function invalidRowForVersionOLDataProvider(): array
+    {
+        return [
+            'no uid and no t3ver_oid' => [[]],
+            'zero uid and no t3ver_oid' => [['uid' => 0]],
+            'positive uid and no t3ver_oid' => [['uid' => 1]],
+            'no uid but t3ver_oid' => [['t3ver_oid' => 1]],
+        ];
+    }
+
+    /**
+     * @test
+     * @param array<string, int> $input
+     * @dataProvider invalidRowForVersionOLDataProvider
+     */
+    public function versionOLForAnInvalidRowUnchangedRowData(array $input): void
+    {
+        $context = new Context();
+        $context->setAspect('workspace', new WorkspaceAspect(4));
+        $subject = new PageRepository($context);
+        $originalInput = $input;
+
+        $subject->versionOL('pages', $input);
+
+        self::assertSame($originalInput, $input);
+    }
 }