Fixed incorrect path traversal calculations for permalinks when the script is installed in a subfolder