- (match user with
- | User (userid, _, _) ->
- let sth = dbh#prepare_cached "delete from recently_visited
- where hostid = ? and userid = ?
- and url = ?" in
- sth#execute [`Int hostid; `Int userid; `String page'];
- let sth = dbh#prepare_cached
- "insert into recently_visited (hostid, userid, url)
- values (?, ?, ?)" in
- sth#execute [`Int hostid; `Int userid; `String page'];
- dbh#commit ()
- | _ -> ());
+ if pageid <> None then (
+ match user with
+ | User (userid, _, _, _) ->
+ let sth = dbh#prepare_cached "delete from recently_visited
+ where hostid = ? and userid = ?
+ and url = ?" in
+ sth#execute [`Int hostid; `Int userid; `String page'];
+ let sth = dbh#prepare_cached
+ "insert into recently_visited (hostid, userid, url)
+ values (?, ?, ?)" in
+ sth#execute [`Int hostid; `Int userid; `String page'];
+ dbh#commit ()
+ | _ -> ()
+ );