Check hasTitle() in RequestContext::setWikiPage()

Calling getTitle() right away can lead to reading from
$wgTitle, so check with hasTitle() first.

This avoids a globaltitlefail in ApiEditPage.

Change-Id: I749cc33dd4f1fd6bc7598be34f37e591d822c3f2
Merge "Check hasTitle() in RequestContext::setWikiPage()"