Use subpage only for media search string

In namespaces that allow for subpages, use the subpage part of the
page title for the initial search string in the MediaInsertDialog
search widget.

Bug: 51290
Change-Id: I31db88b484eee2206719dc337fbd7c70aef93b3a
Check last existing category for whether or not we're trying to re-add it

We were checking all the ones before it, just not the last.

Bug: 66105
Change-Id: Ic22233181a92860c288aa4e3176c469eba58ed43
Merge "Check last existing category for whether or not we're trying to re-add it"
Merge "Use subpage only for media search string"