I had an issue where a page I was creating for a site was appending "-12" to the URL even if I removed it manually. I knew this meant there was a conflicting URL in the system.
I checked it out in the SiteTree table and found the conflicting page. I got it's Parent number in an attempt to find out where it was and found that the Parent ID did not exist in either SiteTree or SiteTree_Live.
So I wrote a little script to check this out by getting all the pages from SiteTree and check that their ParentID exists in turn (except for ParentID of 0). I found litteraly dozens of "Orphan" pages in the system.
So a few questions:
1. Anyone know how something like this happens?
2. Is there a /dev/build function or the likes for cleaning this up?
3. If no to 2., is there any reason why I shouldn't use this script to remove this orphans. e.g. Could their parents be in another table perhaps?