'Retrieve languages, sorted by most common to least common. The
Accept-Languages header sometimes looks weird, i.e.
"en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi-
colon.'

def languages(self):

    language = PageView.headers['Accept-Language']
    first_language = fn.SubStr(language, 1, fn.StrPos(language, ';'))
    return self.get_query().select(first_language, fn.Count(PageView.id)).group_by(first_language).order_by(fn.Count(PageView.id).desc()).tuples()
