added logic and exception handling for bad titles

Change-Id: Idd120ff41e6e414541fc0612250e96ffb83ddccb
adding in ->escaped()

Change-Id: I7763cb6a5a7268126c038dc969dbe91a12ae57a1
Merge branch 'php'

Change-Id: Ic05ff72a67c9a0247e3d34bc3081247b4dad4a4b