Fix: getActivePageIdForLevel function.