Page Override shifts by 5 pages?

I added a text frame to one of my layouts on page 11. (It was a bit too much (dialogue) text to add as System Text.)
Then I imported a new flow in XML, which appended itself after the earlier flows.
The page override shifted to page 17. (From second-to-last page of the original doc to second-to-last page of the added flow.)

Can anyone explain the program logic behind this so I can predict it in the future?

(I found that by using “Swap With Previous Page” I was able to move the override to the correct page, but that would have been difficult if I had other overrides in between the two.)

I wouldn’t expect this to happen. Page overrides are stored by their index in the page sequence, so the only way that a page override could be shifted is if you inserted pages before the place in the sequence where the override exists.

I did not expect it to happen either. Color me mystified.

If you want us to look into it further, you need to provide the project and steps to reproduce the problem.

Thank you for the offer. I’ll keep an eye on it, see if I can reproduce it, and send you something if it recurs.
It seems to have something to do with the override being near the end of the file before another xml import is appended.