I didn't have a ton of time to clean this up super well but this should get you started on some pagination in a custom component... It was originally built for a blog (hence why it pulls the pagenumber settings for that) but you could customize it however you see fit.
<#-- Gets page size from settings (You could hard code your value instead) or defaults to 10 -->
<#assign page_size = settings.name.get("blog.entries_per_page_num")?number!10 />
<#-- Gets page number from the URL and defaults to 1 -->
<#assign page_number = webuisupport.path.parameters.name.get("page", 1) />
<#-- gets all the recent messages-->
<#assign rest_call_url_string = "REST_CALL"/>
<#assign messages = rest(rest_call_url_string+"?restapi.response_style=view&page_size=" + page_size +"&page="+ page_number).messages.message />
<#-- Gets the total number of results -->
<#assign result_list_size = rest(rest_call_url_string + "/count").value />
<#-- This contains the pagination configuration options -->
<#assign pageable_item = webuisupport.paging.pageableItem.setCurrentPageNumber(page_number).setItemsPerPage(page_size).setTotalItems(result_list_size?number).setPagingMode("trivial").build />
<#-- the setPagingMode has a few different options -->
<#-- Your code-->
<ul class="message-list">
<#list messages as message>
<li class="message-item">
<#-- Message Content -->
</li>
</#list>
</ul>
<#-- Pagination Component using the config we defined above -->
<@component id="common.widget.pager" pageableItem=pageable_item />