I updated your rsobj.php file to the latest version (I saved a backup of yours in case you need to revert as rsobj_bak.php).
Then I could use the built in getPageLink() method of the recordset object to get the proper url which uses the URI automatically.