See array $GLOBALS['TSFE']->rootLine
.
it is indexed in natural order, which means index 0 is the root page and the last element is your current position.
So, in your case it would be: 0=>12
, 1=>22
,2=>23
Sorry to initialize an invalid description
source
to share