+ sprintf "<div><b class='error'>%s:</b> %s</div><br />" title msg
+
+let paginate ~size ~page l =
+ let min = 1 + (page-1) * size in
+ let max = page * size in
+ let rec aux i l =
+ match (i, l) with
+ | _, [] -> []
+ | i, hd :: tl when i < min -> aux (i+1) tl
+ | i, hd :: tl when i >= min && i <= max -> hd :: aux (i+1) tl
+ | i, hd :: tl -> []
+ in
+ assert (size > 0 && page > 0);
+ aux 1 l