Install to sub-directory

I have upgraded from 1.3.5 to 1.3.7. I run it in a sub-folder /doc/. After the upgrade I am having issues with may links and paths as example.com/some-odm-file.php instead of example.com/doc/some-odm-file.php
I am unable to login and it gives me a csrf protector 403 which I think is related. I did note that when the database was upgraded it remove the base_url setting. How do I set the correct path?

EDIT
I have worked around the problem by editing the file config/csrf_config.php I remove the $Global part and just put the actual url in for js_URL.
In my custom theme I updated all links in .tpl files to include the folder doc.
I had to do the same for common/head_include.tpl