        :session session}))
 
   (GET ["/admin/edit/post/:id" :id #"[0-9]+"]
-    {session :session, params :params}
+    {session :session, params :params, uri :uri}
     (let [
       session-info (cbauth/make-session-info session)
       authorized (cbauth/admin? session)]

; NOTE: http://clojuredocs.org/ring/ring.util.response/redirect

; TODO: these should be variable arity
(defn response-403
  [session message back-link back-msg]
  (let [
    session-info (cbauth/make-session-info session)

;; END TEST CODE

  ; Blog
  (GET "/blog/" {session :session} (redirect-with-session "/blog" session))
  (GET "/blog"
    {session :session, params :params, uri :uri}
    (let [session-info (cbauth/make-session-info session)]
      {:body (cbblog/get-posts session-info 0 cbsettings/posts-per-page)
        :session session}))

  (GET "/blog/archive/" {session :session} (redirect-with-session "/blog/archive" session))
  (GET "/blog/archive" 
    {session :session, params :params, uri :uri}
    ; TODO
    "hullo")

  (GET ["/blog/:start/:count/" :start #"[0-9]+" :count #"[0-9]+"] {session :session, params :params}
    (redirect-with-session 
      (apply str ["/blog/" (:start params) "/" (:count params)])
      session))
  (GET ["/blog/:start/:count" :start #"[0-9]+" :count #"[0-9]+"]
    {session :session, params :params, uri :uri}
    (let [session-info (cbauth/make-session-info session)]
      {:body (cbblog/get-posts session-info (:start params 0) (:count params 10))
        :session session}))

  (GET ["/post/:id/" :id #"[0-9]+"] {session :session, params :params}
    (redirect-with-session (apply str ["/post/" (:id params)]) session))
  (GET ["/post/:id" :id #"[0-9]+"]
    {session :session, params :params, uri :uri}
    (let [session-info (cbauth/make-session-info session)]
      {:body (cbblog/get-post session-info (:id params nil))
        :session session}))

  ; Admin panel
  (POST "/admin/login"
    {session :session, params :params, uri :uri}
    (if (cbauth/credentials-valid? params)
      ;; TODO: Redirect to the previous page.
      (assoc (response/redirect "/") :session (cbauth/add-admin-session session))
