In order to replace the create URL segment code you need to inherit from EPiServer.Global and override the EPiServer.Global.Application_Start(Object, EventArgs) and EPiServer.Global.GlobalPageValidation_Validators(object, PageValidateEventArgs). The following code shows an example of how to replace the default functionality with custom code.

CopyC#
public class Global : EPiServer.Global
{

    protected void Application_Start(Object sender, EventArgs e)
    {
        GlobalPageValidation.Validators -= EPiServer.Web.UrlSegment.ValidateEventHandler;
        GlobalPageValidation.Validators += 
            new PageValidateEventHandler(GlobalPageValidation_Validators);
    }

    void GlobalPageValidation_Validators(object sender, PageValidateEventArgs e)
    {
        e.Page["PageUrlSegment"] = "JustTesting"; //Apply your own logic here
    }
    //...
    //...
    //...
}