def calculate_pagenumber(elementnumber, batchsize, overlap=0):
    """ Calculate the pagenumber for the navigation """
    realsize = batchsize - overlap
    if realsize != 0:
        pagenumber, remainder = divmod(elementnumber, realsize)
    else:
        pagenumber, remainder = divmod(elementnumber, 1)
    if remainder > overlap:
        pagenumber += 1
    pagenumber = max(pagenumber, 1)
    return pagenumber
