Return a pretty id if title is empty

Also added a test for it.