Preserve page titles when pushing/replacing state

Fixes #942
Fixes #1148