How can I calculate how many back links referenced to a particular page?

Ok, I hope this serves you well.

#+BEGIN_QUERY
{:title "number of links"
 :query [:find ?topic (count ?link)
   :keys name number
   :where
     [?p :block/properties ?prop]
     [(get ?prop :type) ?type]
     [(= ?type "topic")]
     [?p :block/original-name ?topic]
     [?link :block/properties-text-values ?ptv]
     [(get ?ptv :type) ?lt]
     [(= ?lt "Link")]
     [(get ?ptv :topic) ?t]
     [(clojure.string/includes? ?t ?topic)]
 ]
 :result-transform (fn [result] (sort-by (fn [r] (get-in r [:number])) > result))
 :view (fn [rows] [:table
   [:thead [:tr [:th "Topic"] [:th "Links"] ] ]
   [:tbody (for [r rows] [:tr
             [:td [:a {:href 
     (str "#/page/" (clojure.string/replace (get-in r [:name]) "/" "%2F"))}
 (get-in r [:name])]]
             [:td (get-in r [:number])]
           ])
   ]])
}
#+END_QUERY

Here’s what I used in my test: