Hi Adam,
I'll also need the name of the page being investigated ("SomePage" in the above example) so I can use it in a URL.
Unfortunately this hasn't been so easy. The docs suggest Title::getSubpageText() would almost work (it's supposed to return "Baz" from "User:Foo/Bar/Baz" which isn't enough, I need "Bar/Baz") but again it doesn't seem to work properly on the special page and it returns "WhatLinksHere/User:Foo/Bar/Baz" instead.
Any idea how I can get rid of "WhatLinksHere" from the front?
preg_replace immediately comes to mind: http://php.net/manual/en/function.preg-replace.php
-- schnee