Notice thrown when creating numeric pagination on custom query

Sounds like you’ve already done all of the heavy lifting. function_exists() expects a string for the first parameter, so custom_pagination should be 'custom_pagination' (add quotes):

if ( function_exists( 'custom_pagination' ) ) { ...