[eluser]ray73864[/eluser]
One thing you could do, is get the entire ancestry for 'sub-sub-page', starting with the parent 'primary' or 'test-page' and working your way through the chain, get the id for 'test-page' then the id for 'sub-page' then for 'sub-sub-page'.
Once you have the full ancestry then you will be assured that you have the correct page the person is asking for.