Fix the bug with unrecognised extension pages turning up as redlinks
[cocanwiki.git] / scripts / orphans.ml
index cddc0fe..945d818 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: orphans.ml,v 1.4 2006/03/28 13:20:00 rich Exp $
+ * $Id: orphans.ml,v 1.5 2006/03/28 16:24:07 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ let run r (q : cgi) dbh hostid _ _ =
     let border' =
       PGSQL(dbh) "select distinct to_url from links
                    where hostid = $hostid and from_url in $@border
-                              and to_url not in $@pages')" in
+                     and to_url not in $@pages'" in
     if border' = [] then pages'
     else loop pages' border'
   in
@@ -72,8 +72,9 @@ let run r (q : cgi) dbh hostid _ _ =
 
   let table =
     List.map (fun (page, title) ->
-              [ "page", Template.VarString page;
-                "title", Template.VarString title ]) rows in
+               let page = Option.get page in
+               [ "page", Template.VarString page;
+                 "title", Template.VarString title ]) rows in
 
   template#table "pages" table;