--- a/src/query/reslistpager.cpp
+++ b/src/query/reslistpager.cpp
@@ -179,6 +179,8 @@
 	titleOrFilename = utf8fn;
     }
 
+    string parenturl = url_parentfolder(url);
+
     // Result number
     char numbuf[20];
     int docnumforlinks = m_winfirst + 1 + i;
@@ -286,6 +288,7 @@
     subs["L"] = linksbuf.str();
     subs["N"] = numbuf;
     subs["M"] = doc.mimetype;
+    subs["P"] = parenturl;
     subs["R"] = doc.meta[Rcl::Doc::keyrr];
     subs["S"] = sizebuf;
     subs["T"] = maybeEscapeHtml(titleOrFilename);