def get_pageinfo(response, tracktype='recenttracks'):
    """Check how many pages of tracks the user have.

    :param response: json page given by the server
    :param tracktype: Type of information to download from the server, can be either 'recentracks' or 'lovedtracks'
    :return: Number of total pages to import
    """
    totalpages = response[tracktype]['@attr']['totalPages']
    return int(totalpages)
