code: def inputindex(input):
      
      stats = {}
      countminmax = "SUM(count) AS count, MIN(day) AS first, MAX(day) AS last"
      tables = ("moves", "clicks", "scrolls") if "mouse" == input else ("keys", "combos")
      for table in tables:
          stats[table] = db.fetchone("counts", countminmax, type=table)
          stats[table]["days"] = db.fetch("counts", order="day DESC", type=table)
      return bottle.template("input.tpl", locals(), conf=conf)
docs: Handler for showing keyboard or mouse page with day and total links.