Fix page directory boundary detection (#17690)