fixes slug collisions with unpublished pages and slug collisions after undo

fixes partially #2942