[TASK] Avoid: Unknown column 'pid' in 'where clause' when clicking a page in the pagetree

Resolves: #61109