public static String fold( List valueList, final String token )
{
String lastToken = token;
while( true )
	{
	String foldedToken = foldImpl( valueList, lastToken );
	if( foldedToken.equals( lastToken ) )
		{
		break;
		}
	else
		{
		lastToken = foldedToken;
		}
	}

if( lastToken.length() > LIBINJECTION_SQLI_MAX_TOKENS )
	{
	lastToken =  lastToken.substring( 0, LIBINJECTION_SQLI_MAX_TOKENS );
	}

	//do some work after folding

	//Check for magic PHP backquote comment
if( lastToken.length() > 1 )
	{
	int lastIndex = lastToken.length() - 1;
	if( lastToken.charAt( lastIndex ) == 'n'
	 && valueList.get( lastIndex ).equals( "`" )
	  )
		{
		lastToken = lastToken.substring( 0, lastIndex ) + "c";
		}
	}

return lastToken;
}